usb: typec: ucsi: acpi: fix a NULL vs IS_ERR() check in probe
authorDan Carpenter <dan.carpenter@oracle.com>
Mon, 9 May 2022 09:08:28 +0000 (12:08 +0300)
committerRafael J. Wysocki <rafael.j.wysocki@intel.com>
Mon, 30 May 2022 16:03:38 +0000 (18:03 +0200)
The devm_memremap() function never returns NULL.  It returns error
pointers.

Fixes: cdc3d2abf438 ("usb: typec: ucsi: acpi: Map the mailbox with memremap()")
Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
Reviewed-by: Heikki Krogerus <heikki.krogerus@linux.intel.com>
Acked-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
drivers/usb/typec/ucsi/ucsi_acpi.c

index 7455e3a..8873c16 100644 (file)
@@ -133,8 +133,8 @@ static int ucsi_acpi_probe(struct platform_device *pdev)
        }
 
        ua->base = devm_memremap(&pdev->dev, res->start, resource_size(res), MEMREMAP_WB);
-       if (!ua->base)
-               return -ENOMEM;
+       if (IS_ERR(ua->base))
+               return PTR_ERR(ua->base);
 
        ret = guid_parse(UCSI_DSM_UUID, &ua->guid);
        if (ret)