From 5c7eec1a9b90b18837a45cccb7fe3c182dce57d0 Mon Sep 17 00:00:00 2001 From: Jonathan Corbet Date: Sun, 1 Feb 2009 14:52:56 -0700 Subject: Rationalize fasync return values Most fasync implementations do something like: return fasync_helper(...); But fasync_helper() will return a positive value at times - a feature used in at least one place. Thus, a number of other drivers do: err = fasync_helper(...); if (err < 0) return err; return 0; In the interests of consistency and more concise code, it makes sense to map positive return values onto zero where ->fasync() is called. Cc: Al Viro Signed-off-by: Jonathan Corbet --- sound/core/control.c | 7 ++----- sound/core/pcm_native.c | 4 +--- sound/core/timer.c | 6 +----- 3 files changed, 4 insertions(+), 13 deletions(-) (limited to 'sound/core') diff --git a/sound/core/control.c b/sound/core/control.c index 636b3b52ef8b..4b20fa2b7e6d 100644 --- a/sound/core/control.c +++ b/sound/core/control.c @@ -1373,12 +1373,9 @@ EXPORT_SYMBOL(snd_ctl_unregister_ioctl_compat); static int snd_ctl_fasync(int fd, struct file * file, int on) { struct snd_ctl_file *ctl; - int err; + ctl = file->private_data; - err = fasync_helper(fd, file, on, &ctl->fasync); - if (err < 0) - return err; - return 0; + return fasync_helper(fd, file, on, &ctl->fasync); } /* diff --git a/sound/core/pcm_native.c b/sound/core/pcm_native.c index a789efc9df39..a75c194e629e 100644 --- a/sound/core/pcm_native.c +++ b/sound/core/pcm_native.c @@ -3246,9 +3246,7 @@ static int snd_pcm_fasync(int fd, struct file * file, int on) err = fasync_helper(fd, file, on, &runtime->fasync); out: unlock_kernel(); - if (err < 0) - return err; - return 0; + return err; } /* diff --git a/sound/core/timer.c b/sound/core/timer.c index 796532081e81..3f0050d0b71e 100644 --- a/sound/core/timer.c +++ b/sound/core/timer.c @@ -1825,13 +1825,9 @@ static long snd_timer_user_ioctl(struct file *file, unsigned int cmd, static int snd_timer_user_fasync(int fd, struct file * file, int on) { struct snd_timer_user *tu; - int err; tu = file->private_data; - err = fasync_helper(fd, file, on, &tu->fasync); - if (err < 0) - return err; - return 0; + return fasync_helper(fd, file, on, &tu->fasync); } static ssize_t snd_timer_user_read(struct file *file, char __user *buffer, -- cgit v1.2.3