login
Login
/
Register
Search
Forums
News
Blogs
Features
Site
Home
»
Mailing list archives
»
linux-kernel
»
2008
»
July
»
11
Re: [PATCH] ioctl conversion
view
thread
!MAILaRCHIVE_VOTE_RePLACE
Previous message: [
thread
] [
date
] [
author
]
Next message: [
thread
] [
date
] [
author
]
[view in full thread]
From:
Stoyan Gaydarov <stoyboyker@...>
To: Arnd Bergmann <arnd@...>
Cc: <rjw@...>, <pavel@...>, <linux-kernel@...>, <linux-pm@...>
Subject:
Re: [PATCH] ioctl conversion
Date: Friday, July 11, 2008 - 4:21 am
On Fri, Jul 11, 2008 at 3:08 AM, Arnd Bergmann <arnd@arndb.de> wrote:
quoted text
> On Friday 11 July 2008, Stoyan Gaydarov wrote: >> - if (_IOC_TYPE(cmd) != SNAPSHOT_IOC_MAGIC) >> + lock_kernel(); >> + >> + if (_IOC_TYPE(cmd) != SNAPSHOT_IOC_MAGIC) { >> + unlock_kernel(); >> return -ENOTTY; >> - if (_IOC_NR(cmd) > SNAPSHOT_IOC_MAXNR) >> + } >> + if (_IOC_NR(cmd) > SNAPSHOT_IOC_MAXNR) { >> + unlock_kernel(); >> return -ENOTTY; >> - if (!capable(CAP_SYS_ADMIN)) >> + } >> + if (!capable(CAP_SYS_ADMIN)) { >> + unlock_kernel(); >> return -EPERM; >> + } >> >> data = filp->private_data; > > The more common way to express this is to end the function with > > out: > unlock_kernel(); > return ret; > }
This would work normally but there are three early returns and the rest are just switch statements that set the return code.
quoted text
> > and then jump to that label in the error case. This makes it > much easier to verify that you haven't missed a cased. > > Arnd <>< >
--
unsubscribe notice
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to
majordomo@vger.kernel.org
More majordomo info at
http://vger.kernel.org/majordomo-info.html
Please read the FAQ at
http://www.tux.org/lkml/
Previous message: [
thread
] [
date
] [
author
]
Next message: [
thread
] [
date
] [
author
]
Messages in current thread:
[PATCH] ioctl conversion
, Stoyan Gaydarov
, (Thu Jul 10, 8:28 pm)
Re: [PATCH] ioctl conversion
, Arnd Bergmann
, (Fri Jul 11, 4:08 am)
Re: [PATCH] ioctl conversion
, Stoyan Gaydarov
, (Fri Jul 11, 4:21 am)
Re: [PATCH] ioctl conversion
, Arnd Bergmann
, (Fri Jul 11, 5:22 am)
Navigation
Create content
Mailing list archives
Recent posts
Popular discussions
linux-kernel
:
Artem Bityutskiy
[PATCH 10/44 take 2] [UBI] debug unit implementation
Greg Kroah-Hartman
[PATCH 004/196] Chinese: add translation of SubmittingPatches
Trent Piepho
[PATCH] [POWERPC] Improve (in|out)_beXX() asm code
Dave Young
Re: Linux v2.6.24-rc1
git
:
linux-netdev
:
Gerrit Renker
[PATCH 27/37] dccp: Integration of dynamic feature activation - part 2 (server side)
Linus Torvalds
Re: [GIT]: Networking
David Miller
Re: [PATCH] pkt_sched: Destroy gen estimators under rtnl_lock().
Natalie Protasevich
[BUG] New Kernel Bugs
openbsd-misc
:
Colocation donated by:
Who's online
There are currently
1 user
and
658 guests
online.
Online users
strcmp
Syndicate