* [PATCH] usb: typec: ucsi: acpi: fix a NULL vs IS_ERR() check in probe
@ 2022-05-09 9:08 Dan Carpenter
2022-05-09 13:14 ` Heikki Krogerus
2022-05-12 9:36 ` Greg Kroah-Hartman
0 siblings, 2 replies; 4+ messages in thread
From: Dan Carpenter @ 2022-05-09 9:08 UTC (permalink / raw)
To: Heikki Krogerus
Cc: Greg Kroah-Hartman, Rafael J. Wysocki, linux-usb, kernel-janitors
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>
---
drivers/usb/typec/ucsi/ucsi_acpi.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/drivers/usb/typec/ucsi/ucsi_acpi.c b/drivers/usb/typec/ucsi/ucsi_acpi.c
index 7455e3aff2be..8873c1644a29 100644
--- a/drivers/usb/typec/ucsi/ucsi_acpi.c
+++ b/drivers/usb/typec/ucsi/ucsi_acpi.c
@@ -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)
--
2.35.1
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [PATCH] usb: typec: ucsi: acpi: fix a NULL vs IS_ERR() check in probe
2022-05-09 9:08 [PATCH] usb: typec: ucsi: acpi: fix a NULL vs IS_ERR() check in probe Dan Carpenter
@ 2022-05-09 13:14 ` Heikki Krogerus
2022-05-12 9:36 ` Greg Kroah-Hartman
1 sibling, 0 replies; 4+ messages in thread
From: Heikki Krogerus @ 2022-05-09 13:14 UTC (permalink / raw)
To: Dan Carpenter
Cc: Greg Kroah-Hartman, Rafael J. Wysocki, linux-usb, kernel-janitors
On Mon, May 09, 2022 at 12:08:28PM +0300, Dan Carpenter wrote:
> 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 <heikki.krogerus@linux.intel.com>
> Fixes: cdc3d2abf438 ("usb: typec: ucsi: acpi: Map the mailbox with memremap()")
> Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
> ---
> drivers/usb/typec/ucsi/ucsi_acpi.c | 4 ++--
> 1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/usb/typec/ucsi/ucsi_acpi.c b/drivers/usb/typec/ucsi/ucsi_acpi.c
> index 7455e3aff2be..8873c1644a29 100644
> --- a/drivers/usb/typec/ucsi/ucsi_acpi.c
> +++ b/drivers/usb/typec/ucsi/ucsi_acpi.c
> @@ -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)
> --
> 2.35.1
--
heikki
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] usb: typec: ucsi: acpi: fix a NULL vs IS_ERR() check in probe
2022-05-09 9:08 [PATCH] usb: typec: ucsi: acpi: fix a NULL vs IS_ERR() check in probe Dan Carpenter
2022-05-09 13:14 ` Heikki Krogerus
@ 2022-05-12 9:36 ` Greg Kroah-Hartman
2022-05-30 16:10 ` Rafael J. Wysocki
1 sibling, 1 reply; 4+ messages in thread
From: Greg Kroah-Hartman @ 2022-05-12 9:36 UTC (permalink / raw)
To: Dan Carpenter
Cc: Heikki Krogerus, Rafael J. Wysocki, linux-usb, kernel-janitors
On Mon, May 09, 2022 at 12:08:28PM +0300, Dan Carpenter wrote:
> 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:
Acked-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] usb: typec: ucsi: acpi: fix a NULL vs IS_ERR() check in probe
2022-05-12 9:36 ` Greg Kroah-Hartman
@ 2022-05-30 16:10 ` Rafael J. Wysocki
0 siblings, 0 replies; 4+ messages in thread
From: Rafael J. Wysocki @ 2022-05-30 16:10 UTC (permalink / raw)
To: Greg Kroah-Hartman, Dan Carpenter
Cc: Heikki Krogerus, linux-usb, kernel-janitors
On 5/12/2022 11:36 AM, Greg Kroah-Hartman wrote:
> On Mon, May 09, 2022 at 12:08:28PM +0300, Dan Carpenter wrote:
>> 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:
>
> Acked-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Applied now, thanks!
Fortunately, I've not pushed the original change before applying it.
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2022-05-30 16:10 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-05-09 9:08 [PATCH] usb: typec: ucsi: acpi: fix a NULL vs IS_ERR() check in probe Dan Carpenter
2022-05-09 13:14 ` Heikki Krogerus
2022-05-12 9:36 ` Greg Kroah-Hartman
2022-05-30 16:10 ` Rafael J. Wysocki
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.