char: xilinx_hwicap: Fix NULL vs IS_ERR() bug
authorDan Carpenter <dan.carpenter@linaro.org>
Tue, 20 Feb 2024 09:02:31 +0000 (12:02 +0300)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Thu, 7 Mar 2024 21:48:38 +0000 (21:48 +0000)
The devm_platform_ioremap_resource() function returns error pointers.
It never returns NULL.  Update the check accordingly.

Fixes: 672371832193 ("char: xilinx_hwicap: Modernize driver probe")
Signed-off-by: Dan Carpenter <dan.carpenter@linaro.org>
Acked-by: Michal Simek <michal.simek@amd.com>
Link: https://lore.kernel.org/r/ef647a9c-b1b7-4338-9bc0-28165ec2a367@moroto.mountain
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/char/xilinx_hwicap/xilinx_hwicap.c

index 3aaa4b4d9f08b70ae970fbcba4252a51cab5d829..4f6c3cb8aa4138e6948d7b5971595d0dd4de07b7 100644 (file)
@@ -639,8 +639,8 @@ static int hwicap_setup(struct platform_device *pdev, int id,
        dev_set_drvdata(dev, drvdata);
 
        drvdata->base_address = devm_platform_ioremap_resource(pdev, 0);
-       if (!drvdata->base_address) {
-               retval = -ENODEV;
+       if (IS_ERR(drvdata->base_address)) {
+               retval = PTR_ERR(drvdata->base_address);
                goto failed;
        }