mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH] ASoC: soc-card: Fix a reversed if condition
@ 2024-04-08  7:38 Dan Carpenter
  2024-04-08 12:43 ` Mark Brown
  0 siblings, 1 reply; 3+ messages in thread
From: Dan Carpenter @ 2024-04-08  7:38 UTC (permalink / raw)
  To: Richard Fitzgerald
  Cc: Liam Girdwood, Mark Brown, Jaroslav Kysela, Takashi Iwai,
	linux-sound, linux-kernel, kernel-janitors

This if condition is reversed.  But fortunately, it has very little
impact on runtime behavior.

Fixes: ef7784e41db7 ("ASoC: soc-card: Add KUnit test case for snd_soc_card_get_kcontrol")
Signed-off-by: Dan Carpenter <dan.carpenter@linaro.org>
---
 sound/soc/soc-card-test.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/sound/soc/soc-card-test.c b/sound/soc/soc-card-test.c
index 075c52fe82e5..a9fe7d243807 100644
--- a/sound/soc/soc-card-test.c
+++ b/sound/soc/soc-card-test.c
@@ -148,7 +148,7 @@ static int soc_card_test_case_init(struct kunit *test)
 	priv->card->owner = THIS_MODULE;
 
 	ret = snd_soc_register_card(priv->card);
-	if (!ret)
+	if (ret)
 		return ret;
 
 	return 0;
-- 
2.43.0


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

* Re: [PATCH] ASoC: soc-card: Fix a reversed if condition
  2024-04-08  7:38 [PATCH] ASoC: soc-card: Fix a reversed if condition Dan Carpenter
@ 2024-04-08 12:43 ` Mark Brown
  2024-04-08 12:50   ` Dan Carpenter
  0 siblings, 1 reply; 3+ messages in thread
From: Mark Brown @ 2024-04-08 12:43 UTC (permalink / raw)
  To: Dan Carpenter
  Cc: Richard Fitzgerald, Liam Girdwood, Jaroslav Kysela, Takashi Iwai,
	linux-sound, linux-kernel, kernel-janitors

[-- Attachment #1: Type: text/plain, Size: 259 bytes --]

On Mon, Apr 08, 2024 at 10:38:02AM +0300, Dan Carpenter wrote:

>  	ret = snd_soc_register_card(priv->card);
> -	if (!ret)
> +	if (ret)
>  		return ret;
>  
>  	return 0;

Clearly a better fix here would just be to remove the conditional
entirely.

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 488 bytes --]

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

* Re: [PATCH] ASoC: soc-card: Fix a reversed if condition
  2024-04-08 12:43 ` Mark Brown
@ 2024-04-08 12:50   ` Dan Carpenter
  0 siblings, 0 replies; 3+ messages in thread
From: Dan Carpenter @ 2024-04-08 12:50 UTC (permalink / raw)
  To: Mark Brown
  Cc: Richard Fitzgerald, Liam Girdwood, Jaroslav Kysela, Takashi Iwai,
	linux-sound, linux-kernel, kernel-janitors

On Mon, Apr 08, 2024 at 01:43:09PM +0100, Mark Brown wrote:
> On Mon, Apr 08, 2024 at 10:38:02AM +0300, Dan Carpenter wrote:
> 
> >  	ret = snd_soc_register_card(priv->card);
> > -	if (!ret)
> > +	if (ret)
> >  		return ret;
> >  
> >  	return 0;
> 
> Clearly a better fix here would just be to remove the conditional
> entirely.

Hm...  Actually, it should be:

	if (ret) {
		put_device(priv->card_dev);
		return ret;
	}

	return 0;

Let me resend with that instead.

regards,
dan carpenter

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

end of thread, other threads:[~2024-04-08 12:50 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-04-08  7:38 [PATCH] ASoC: soc-card: Fix a reversed if condition Dan Carpenter
2024-04-08 12:43 ` Mark Brown
2024-04-08 12:50   ` Dan Carpenter

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®