]> git.proxmox.com Git - mirror_ubuntu-jammy-kernel.git/commitdiff
ALSA: n64: Fix return value check in n64audio_probe()
authorWei Yongjun <weiyongjun1@huawei.com>
Wed, 24 Feb 2021 01:38:03 +0000 (01:38 +0000)
committerTakashi Iwai <tiwai@suse.de>
Thu, 25 Feb 2021 09:29:13 +0000 (10:29 +0100)
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>
Reviewed-by: Lauri Kasanen <cand@gmx.com>
Link: https://lore.kernel.org/r/20210224013803.2146953-1-weiyongjun1@huawei.com
Signed-off-by: Takashi Iwai <tiwai@suse.de>
sound/mips/snd-n64.c

index ca6b4b99da981c349089df833cfa2463ed027279..e35e93157755f0bf1e61ca4987b76f59dc8db3c6 100644 (file)
@@ -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;
        }