usb: typec: ucsi: acpi: fix a NULL vs IS_ERR() check in probe
Subsystems (3)
PATCH 1/1 usb: typec: ucsi: acpi: fix a NULL vs IS_ERR() check in probe
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 <[email protected]>
--- drivers/usb/typec/ucsi/ucsi_acpi.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/usb/typec/ucsi/ucsi_acpi.c +2 -2
@@ -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)
Signature · 1 line
2.35.1
Quoted 2 lines · Dan Carpenter
The
devm_memremap()function never returns NULL. It returns error pointers.
Oh, so memremap() and devm_memremap() don't behave the same way. That's a bummer. Thanks for catching this.
Reviewed-by Heikki Krogerus <[email protected]>
Quoted 23 lines
Fixes cdc3d2abf438 ("usb: typec: ucsi: acpi: Map the mailbox with memremap()")Signed-off-by Dan Carpenter <[email protected]>--- drivers/usb/typec/ucsi/ucsi_acpi.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)drivers/usb/typec/ucsi/ucsi_acpi.c +2
-2@@ -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)Signature · 1 line
2.35.1
Signature · 1 line
heikki
Quoted 4 lines · Dan Carpenter
The
devm_memremap()function never returns NULL. It returns error pointers.Fixes cdc3d2abf438 ("usb: typec: ucsi: acpi: Map the mailbox with memremap()")
As this is in Rafael's tree, he needs to take it, I can't:
Quoted 8 lines · Greg Kroah-Hartman
Quoted 4 lines · Dan Carpenter
The
devm_memremap()function never returns NULL. It returns error pointers.Fixes cdc3d2abf438 ("usb: typec: ucsi: acpi: Map the mailbox with memremap()")As this is in Rafael's tree, he needs to take it, I can't:
Applied now, thanks!
Fortunately, I've not pushed the original change before applying it.