Message ID | b4d0b274-23ac-4369-7119-a77e5108578b@users.sourceforge.net (mailing list archive) |
---|---|
State | New, archived |
Headers | show |
SF Markus Elfring wrote: > A local variable was set to an error code in two cases before a concrete > error situation was detected. And why would that be a problem? http://yarchive.net/comp/linux/error_jumps.html > - ret = -EBUSY; > - if (state.busy) > + if (state.busy) { > + ret = -EBUSY; > goto out; > + } Regards, Clemens
diff --git a/sound/oss/dmasound/dmasound_core.c b/sound/oss/dmasound/dmasound_core.c index f4ee85a4c42f..2bdd1d619a7f 100644 --- a/sound/oss/dmasound/dmasound_core.c +++ b/sound/oss/dmasound/dmasound_core.c @@ -1269,13 +1269,15 @@ static int state_open(struct inode *inode, struct file *file) int ret; mutex_lock(&dmasound_core_mutex); - ret = -EBUSY; - if (state.busy) + if (state.busy) { + ret = -EBUSY; goto out; + } - ret = -ENODEV; - if (!try_module_get(dmasound.mach.owner)) + if (!try_module_get(dmasound.mach.owner)) { + ret = -ENODEV; goto out; + } state.ptr = 0; state.busy = 1;