* [PATCH -next] usb: typec: ucsi: fix return value check in ucsi_acpi_probe()
@ 2022-05-16 13:15 Yang Yingliang
2022-05-17 9:20 ` Sergei Shtylyov
2022-05-17 9:40 ` Heikki Krogerus
0 siblings, 2 replies; 3+ messages in thread
From: Yang Yingliang @ 2022-05-16 13:15 UTC (permalink / raw)
To: linux-kernel, linux-usb; +Cc: heikki.krogerus, gregkh
If memremap() fails, it never returns NULL. Replace NULL check
with IS_ERR().
Fixes: cdc3d2abf438 ("usb: typec: ucsi: acpi: Map the mailbox with memremap()")
Reported-by: Hulk Robot <hulkci@huawei.com>
Signed-off-by: Yang Yingliang <yangyingliang@huawei.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.25.1
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH -next] usb: typec: ucsi: fix return value check in ucsi_acpi_probe()
2022-05-16 13:15 [PATCH -next] usb: typec: ucsi: fix return value check in ucsi_acpi_probe() Yang Yingliang
@ 2022-05-17 9:20 ` Sergei Shtylyov
2022-05-17 9:40 ` Heikki Krogerus
1 sibling, 0 replies; 3+ messages in thread
From: Sergei Shtylyov @ 2022-05-17 9:20 UTC (permalink / raw)
To: Yang Yingliang, linux-kernel, linux-usb; +Cc: heikki.krogerus, gregkh
Hello!
On 5/16/22 4:15 PM, Yang Yingliang wrote:
> If memremap() fails, it never returns NULL. Replace NULL check
Oh, memremap() does! But devm_memremap() doesn't, indeed. :-)
> with IS_ERR().
>
> Fixes: cdc3d2abf438 ("usb: typec: ucsi: acpi: Map the mailbox with memremap()")
> Reported-by: Hulk Robot <hulkci@huawei.com>
> Signed-off-by: Yang Yingliang <yangyingliang@huawei.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)
MBR, Sergey
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH -next] usb: typec: ucsi: fix return value check in ucsi_acpi_probe()
2022-05-16 13:15 [PATCH -next] usb: typec: ucsi: fix return value check in ucsi_acpi_probe() Yang Yingliang
2022-05-17 9:20 ` Sergei Shtylyov
@ 2022-05-17 9:40 ` Heikki Krogerus
1 sibling, 0 replies; 3+ messages in thread
From: Heikki Krogerus @ 2022-05-17 9:40 UTC (permalink / raw)
To: Yang Yingliang; +Cc: linux-kernel, linux-usb, gregkh
On Mon, May 16, 2022 at 09:15:27PM +0800, Yang Yingliang wrote:
> If memremap() fails, it never returns NULL. Replace NULL check
> with IS_ERR().
There's already a fix pending for this:
https://patchwork.kernel.org/project/linux-usb/patch/YnjaDBXLmwouCB3M@kili/
thanks,
> Fixes: cdc3d2abf438 ("usb: typec: ucsi: acpi: Map the mailbox with memremap()")
> Reported-by: Hulk Robot <hulkci@huawei.com>
> Signed-off-by: Yang Yingliang <yangyingliang@huawei.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)
--
heikki
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2022-05-17 9:41 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-05-16 13:15 [PATCH -next] usb: typec: ucsi: fix return value check in ucsi_acpi_probe() Yang Yingliang
2022-05-17 9:20 ` Sergei Shtylyov
2022-05-17 9:40 ` Heikki Krogerus
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).