From: Dan Carpenter <dan.carpenter@oracle.com>
To: Muhammad Usama Anjum <musamaanjum@gmail.com>
Cc: Jaroslav Kysela <perex@perex.cz>, Takashi Iwai <tiwai@suse.com>,
alsa-devel@alsa-project.org, linux-kernel@vger.kernel.org,
kernel-janitors@vger.kernel.org, colin.king@canonical.com
Subject: Re: [PATCH] ALSA: usb-audio: Fix missing return assignment
Date: Wed, 24 Mar 2021 21:50:47 +0300 [thread overview]
Message-ID: <20210324185047.GP1667@kadam> (raw)
In-Reply-To: <20210324172604.GA380592@LEGION>
On Wed, Mar 24, 2021 at 10:26:04PM +0500, Muhammad Usama Anjum wrote:
> Return value of usb_driver_claim_interface should not be ignored.
> Instead it should be stored in err variable and returned from
> this function.
>
> Signed-off-by: Muhammad Usama Anjum <musamaanjum@gmail.com>
> ---
> sound/usb/quirks.c | 4 ++--
> 1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/sound/usb/quirks.c b/sound/usb/quirks.c
> index 9e5e37eff10e..dd32ceaef18a 100644
> --- a/sound/usb/quirks.c
> +++ b/sound/usb/quirks.c
> @@ -427,10 +427,10 @@ static int create_autodetect_quirks(struct snd_usb_audio *chip,
>
> err = create_autodetect_quirk(chip, iface, driver);
> if (err >= 0)
create_autodetect_quirk() never returns positive values. Flip this
condition. (Always do error handling, don't do success handling).
if (err)
continue;
> - usb_driver_claim_interface(driver, iface, (void *)-1L);
> + err = usb_driver_claim_interface(driver, iface, (void *)-1L);
This is in a loop so only the last return value is used. Which seems
sort of weird and pointless that the last value would matter more than
the others.
> }
>
> - return 0;
> + return err;
regards,
dan carpenter
next prev parent reply other threads:[~2021-03-24 18:53 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-03-24 17:26 [PATCH] ALSA: usb-audio: Fix missing return assignment Muhammad Usama Anjum
2021-03-24 18:50 ` Dan Carpenter [this message]
2021-03-24 20:24 ` Muhammad Usama Anjum
2021-03-25 7:07 ` Dan Carpenter
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20210324185047.GP1667@kadam \
--to=dan.carpenter@oracle.com \
--cc=alsa-devel@alsa-project.org \
--cc=colin.king@canonical.com \
--cc=kernel-janitors@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=musamaanjum@gmail.com \
--cc=perex@perex.cz \
--cc=tiwai@suse.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).