linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] ALSA: usb-audio: Don't store returned value and check for errors
@ 2021-03-25  8:36 Muhammad Usama Anjum
  2021-03-26  8:00 ` Takashi Iwai
  0 siblings, 1 reply; 2+ messages in thread
From: Muhammad Usama Anjum @ 2021-03-25  8:36 UTC (permalink / raw)
  To: Jaroslav Kysela, Takashi Iwai, alsa-devel, linux-kernel,
	kernel-janitors, colin.king, dan.carpenter
  Cc: musamaanjum

The returned value by create_autodetect_quirk isn't being used other
than in the success check on next line. Remove the return value
assignement. Check for error values instead of success check.

Signed-off-by: Muhammad Usama Anjum <musamaanjum@gmail.com>
---
 sound/usb/quirks.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/sound/usb/quirks.c b/sound/usb/quirks.c
index 9e5e37eff10e..5ce5f4ecb9d0 100644
--- a/sound/usb/quirks.c
+++ b/sound/usb/quirks.c
@@ -425,9 +425,9 @@ static int create_autodetect_quirks(struct snd_usb_audio *chip,
 							USB_CLASS_VENDOR_SPEC)
 			continue;
 
-		err = create_autodetect_quirk(chip, iface, driver);
-		if (err >= 0)
-			usb_driver_claim_interface(driver, iface, (void *)-1L);
+		if (create_autodetect_quirk(chip, iface, driver) < 0)
+			continue;
+		usb_driver_claim_interface(driver, iface, (void *)-1L);
 	}
 
 	return 0;
-- 
2.25.1


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH] ALSA: usb-audio: Don't store returned value and check for errors
  2021-03-25  8:36 [PATCH] ALSA: usb-audio: Don't store returned value and check for errors Muhammad Usama Anjum
@ 2021-03-26  8:00 ` Takashi Iwai
  0 siblings, 0 replies; 2+ messages in thread
From: Takashi Iwai @ 2021-03-26  8:00 UTC (permalink / raw)
  To: Muhammad Usama Anjum
  Cc: Jaroslav Kysela, Takashi Iwai, alsa-devel, linux-kernel,
	kernel-janitors, colin.king, dan.carpenter

On Thu, 25 Mar 2021 09:36:41 +0100,
Muhammad Usama Anjum wrote:
> 
> The returned value by create_autodetect_quirk isn't being used other
> than in the success check on next line. Remove the return value
> assignement. Check for error values instead of success check.
> 
> Signed-off-by: Muhammad Usama Anjum <musamaanjum@gmail.com>
> ---
>  sound/usb/quirks.c | 6 +++---
>  1 file changed, 3 insertions(+), 3 deletions(-)
> 
> diff --git a/sound/usb/quirks.c b/sound/usb/quirks.c
> index 9e5e37eff10e..5ce5f4ecb9d0 100644
> --- a/sound/usb/quirks.c
> +++ b/sound/usb/quirks.c
> @@ -425,9 +425,9 @@ static int create_autodetect_quirks(struct snd_usb_audio *chip,
>  							USB_CLASS_VENDOR_SPEC)
>  			continue;
>  
> -		err = create_autodetect_quirk(chip, iface, driver);
> -		if (err >= 0)
> -			usb_driver_claim_interface(driver, iface, (void *)-1L);
> +		if (create_autodetect_quirk(chip, iface, driver) < 0)
> +			continue;
> +		usb_driver_claim_interface(driver, iface, (void *)-1L);

Hm, basically this change is only for readability (the code
optimization makes almost no sense), and the readability itself isn't
improved significantly by this change, either.

That is, I'm fine to take this, but OTOH, I see no compelling reason
to do so...


thanks,

Takashi

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2021-03-26  8:01 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-03-25  8:36 [PATCH] ALSA: usb-audio: Don't store returned value and check for errors Muhammad Usama Anjum
2021-03-26  8:00 ` Takashi Iwai

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).