[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <alpine.LNX.2.00.1007110913120.16744@eeebox2.perex-int.cz>
Date: Sun, 11 Jul 2010 09:15:22 +0200 (CEST)
From: Jaroslav Kysela <perex@...ex.cz>
To: Arnd Bergmann <arnd@...db.de>
cc: LKML <linux-kernel@...r.kernel.org>,
John Kacur <jkacur@...hat.com>,
Frederic Weisbecker <fweisbec@...il.com>,
Takashi Iwai <tiwai@...e.de>,
ALSA development <alsa-devel@...a-project.org>
Subject: Re: [PATCH 3/3] sound: push BKL into open functions
On Sat, 10 Jul 2010, Arnd Bergmann wrote:
> --- a/sound/core/hwdep.c
> +++ b/sound/core/hwdep.c
> @@ -94,13 +94,18 @@ static int snd_hwdep_open(struct inode *inode, struct file * file)
> hw = snd_lookup_oss_minor_data(iminor(inode),
> SNDRV_OSS_DEVICE_TYPE_DMFM);
> #endif
> - } else
> - return -ENXIO;
> + } else {
> + err = -ENXIO;
> + goto out;
> + }
> +
> + err = -ENODEV;
> if (hw == NULL)
> - return -ENODEV;
> + goto out;
>
> + err = -EFAULT;
> if (!try_module_get(hw->card->module))
> - return -EFAULT;
> + goto out;
>
> init_waitqueue_entry(&wait, current);
> add_wait_queue(&hw->open_wait, &wait);
> @@ -147,6 +152,7 @@ static int snd_hwdep_open(struct inode *inode, struct file * file)
> mutex_unlock(&hw->open_mutex);
> if (err < 0)
> module_put(hw->card->module);
> +out:
> return err;
> }
>
> diff --git a/sound/core/oss/mixer_oss.c b/sound/core/oss/mixer_oss.c
> index f50ebf2..c30b1f3 100644
> --- a/sound/core/oss/mixer_oss.c
> +++ b/sound/core/oss/mixer_oss.c
> @@ -49,17 +49,19 @@ static int snd_mixer_oss_open(struct inode *inode, struct file *file)
>
> card = snd_lookup_oss_minor_data(iminor(inode),
> SNDRV_OSS_DEVICE_TYPE_MIXER);
> - if (card == NULL)
> - return -ENODEV;
> - if (card->mixer_oss == NULL)
> - return -ENODEV;
> + err = -ENODEV;
> + if (card == NULL || card->mixer_oss == NULL)
> + goto out;
> +
> err = snd_card_file_add(card, file);
> if (err < 0)
> - return err;
> + goto out;
> +
> fmixer = kzalloc(sizeof(*fmixer), GFP_KERNEL);
> if (fmixer == NULL) {
> snd_card_file_remove(card, file);
> - return -ENOMEM;
> + err = -ENOMEM;
> + goto out;
> }
> fmixer->card = card;
> fmixer->mixer = card->mixer_oss;
> @@ -67,9 +69,10 @@ static int snd_mixer_oss_open(struct inode *inode, struct file *file)
> if (!try_module_get(card->module)) {
> kfree(fmixer);
> snd_card_file_remove(card, file);
> - return -EFAULT;
> + err = -EFAULT;
> }
> - return 0;
> +out:
> + return err;
> }
>
I don't see any reason (benefit) to add gotos to these two functions.
Jaroslav
-----
Jaroslav Kysela <perex@...ex.cz>
Linux Kernel Sound Maintainer
ALSA Project; Red Hat, Inc.
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists