mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH v2] ASoC: soc-card: soc-card-test: Fix some error handling in probe()
@ 2024-04-10 14:22 Dan Carpenter
  2024-04-10 14:43 ` Richard Fitzgerald
  0 siblings, 1 reply; 4+ messages in thread
From: Dan Carpenter @ 2024-04-10 14:22 UTC (permalink / raw)
  To: Richard Fitzgerald
  Cc: Liam Girdwood, Mark Brown, Jaroslav Kysela, Takashi Iwai,
	linux-sound, linux-kernel, kernel-janitors

Fix this reversed if statement and call put_device() before returning
the error code.

Fixes: ef7784e41db7 ("ASoC: soc-card: Add KUnit test case for snd_soc_card_get_kcontrol")
Signed-off-by: Dan Carpenter <dan.carpenter@linaro.org>
---
v2: call put_device()

 sound/soc/soc-card-test.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/sound/soc/soc-card-test.c b/sound/soc/soc-card-test.c
index 075c52fe82e5..faf9a3d46884 100644
--- a/sound/soc/soc-card-test.c
+++ b/sound/soc/soc-card-test.c
@@ -148,8 +148,10 @@ 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) {
+		put_device(priv->card_dev);
 		return ret;
+	}
 
 	return 0;
 }
-- 
2.43.0


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

end of thread, other threads:[~2024-04-10 15:37 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-04-10 14:22 [PATCH v2] ASoC: soc-card: soc-card-test: Fix some error handling in probe() Dan Carpenter
2024-04-10 14:43 ` Richard Fitzgerald
2024-04-10 15:31   ` Dan Carpenter
2024-04-10 15:37     ` Richard Fitzgerald

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®