* [PATCH] usb: misc: brcmstb-usb-pinmap: Fix an IS_ERR() vs NULL check
@ 2020-11-02 7:56 Dan Carpenter
2020-11-03 19:53 ` Alan Cooper
0 siblings, 1 reply; 2+ messages in thread
From: Dan Carpenter @ 2020-11-02 7:56 UTC (permalink / raw)
To: Al Cooper
Cc: Greg Kroah-Hartman, Florian Fainelli, bcm-kernel-feedback-list,
linux-usb, kernel-janitors
The devm_ioremap() function doesn't return error pointers, it returns
NULL on error.
Fixes: 517c4c44b323 ("usb: Add driver to allow any GPIO to be used for 7211 USB signals")
Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
---
The commit original commit "usb: Add driver to allow any GPIO to ..."
has a bad subsystem prefix. This is a common anti-pattern for new
drivers. (Although less common after I started whinging to everyone
about it). It means that the first person to fix a bug in the driver
has to imagine what the original author wanted. Sometimes people get
annoyed which prefix we pick for them.
drivers/usb/misc/brcmstb-usb-pinmap.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/drivers/usb/misc/brcmstb-usb-pinmap.c b/drivers/usb/misc/brcmstb-usb-pinmap.c
index 02144c39aaba..2326e60545f7 100644
--- a/drivers/usb/misc/brcmstb-usb-pinmap.c
+++ b/drivers/usb/misc/brcmstb-usb-pinmap.c
@@ -277,8 +277,8 @@ static int __init brcmstb_usb_pinmap_probe(struct platform_device *pdev)
pdata->out_pins = (struct out_pin *)(pdata->in_pins + in_count);
pdata->regs = devm_ioremap(&pdev->dev, r->start, resource_size(r));
- if (IS_ERR(pdata->regs))
- return PTR_ERR(pdata->regs);
+ if (!pdata->regs)
+ return -ENOMEM;
platform_set_drvdata(pdev, pdata);
err = parse_pins(&pdev->dev, dn, pdata);
--
2.28.0
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH] usb: misc: brcmstb-usb-pinmap: Fix an IS_ERR() vs NULL check
2020-11-02 7:56 [PATCH] usb: misc: brcmstb-usb-pinmap: Fix an IS_ERR() vs NULL check Dan Carpenter
@ 2020-11-03 19:53 ` Alan Cooper
0 siblings, 0 replies; 2+ messages in thread
From: Alan Cooper @ 2020-11-03 19:53 UTC (permalink / raw)
To: Dan Carpenter
Cc: Greg Kroah-Hartman, Florian Fainelli, BCM Kernel Feedback,
USB list, kernel-janitors
On Mon, Nov 2, 2020 at 2:57 AM Dan Carpenter <dan.carpenter@oracle.com> wrote:
>
> The devm_ioremap() function doesn't return error pointers, it returns
> NULL on error.
>
> Fixes: 517c4c44b323 ("usb: Add driver to allow any GPIO to be used for 7211 USB signals")
> Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
> ---
> The commit original commit "usb: Add driver to allow any GPIO to ..."
> has a bad subsystem prefix. This is a common anti-pattern for new
> drivers. (Although less common after I started whinging to everyone
> about it). It means that the first person to fix a bug in the driver
> has to imagine what the original author wanted. Sometimes people get
> annoyed which prefix we pick for them.
>
> drivers/usb/misc/brcmstb-usb-pinmap.c | 4 ++--
> 1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/usb/misc/brcmstb-usb-pinmap.c b/drivers/usb/misc/brcmstb-usb-pinmap.c
> index 02144c39aaba..2326e60545f7 100644
> --- a/drivers/usb/misc/brcmstb-usb-pinmap.c
> +++ b/drivers/usb/misc/brcmstb-usb-pinmap.c
> @@ -277,8 +277,8 @@ static int __init brcmstb_usb_pinmap_probe(struct platform_device *pdev)
> pdata->out_pins = (struct out_pin *)(pdata->in_pins + in_count);
>
> pdata->regs = devm_ioremap(&pdev->dev, r->start, resource_size(r));
> - if (IS_ERR(pdata->regs))
> - return PTR_ERR(pdata->regs);
> + if (!pdata->regs)
> + return -ENOMEM;
> platform_set_drvdata(pdev, pdata);
>
> err = parse_pins(&pdev->dev, dn, pdata);
> --
> 2.28.0
>
Acked-by: Al Cooper <alcooperx@gmail.com> # prefix change noted
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2020-11-03 19:53 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-11-02 7:56 [PATCH] usb: misc: brcmstb-usb-pinmap: Fix an IS_ERR() vs NULL check Dan Carpenter
2020-11-03 19:53 ` Alan Cooper
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).