mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH -next] sound: n64: Fix return value check in n64audio_probe()
@ 2021-02-24  1:38 Wei Yongjun
  2021-02-24  7:10 ` Lauri Kasanen
  2021-02-25  9:29 ` Takashi Iwai
  0 siblings, 2 replies; 3+ messages in thread
From: Wei Yongjun @ 2021-02-24  1:38 UTC (permalink / raw)
  To: Hulk Robot, Jaroslav Kysela, Takashi Iwai, Lauri Kasanen,
	Thomas Bogendoerfer
  Cc: Wei Yongjun, alsa-devel, linux-kernel

In case of error, the function devm_platform_ioremap_resource()
returns ERR_PTR() and never returns NULL. The NULL test in the
return value check should be replaced with IS_ERR().

Fixes: 1448f8acf4cc ("sound: Add n64 driver")
Reported-by: Hulk Robot <hulkci@huawei.com>
Signed-off-by: Wei Yongjun <weiyongjun1@huawei.com>
---
 sound/mips/snd-n64.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/sound/mips/snd-n64.c b/sound/mips/snd-n64.c
index ca6b4b99da98..e35e93157755 100644
--- a/sound/mips/snd-n64.c
+++ b/sound/mips/snd-n64.c
@@ -312,14 +312,14 @@ static int __init n64audio_probe(struct platform_device *pdev)
 	}
 
 	priv->mi_reg_base = devm_platform_ioremap_resource(pdev, 0);
-	if (!priv->mi_reg_base) {
-		err = -EINVAL;
+	if (IS_ERR(priv->mi_reg_base)) {
+		err = PTR_ERR(priv->mi_reg_base);
 		goto fail_dma_alloc;
 	}
 
 	priv->ai_reg_base = devm_platform_ioremap_resource(pdev, 1);
-	if (!priv->ai_reg_base) {
-		err = -EINVAL;
+	if (IS_ERR(priv->ai_reg_base)) {
+		err = PTR_ERR(priv->ai_reg_base);
 		goto fail_dma_alloc;
 	}
 


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

end of thread, other threads:[~2021-02-25  9:30 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-02-24  1:38 [PATCH -next] sound: n64: Fix return value check in n64audio_probe() Wei Yongjun
2021-02-24  7:10 ` Lauri Kasanen
2021-02-25  9:29 ` Takashi Iwai

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®