2016-10-28 09:10:31

by Christophe JAILLET

[permalink] [raw]
Subject: [PATCH] drm/tegra: dpaux: Fix error handling

'devm_pinctrl_register()' returns an error pointer or a valid handle. So
checking for NULL here is pointless and can never trigger.

Check the returned value with IS_ERR instead and propagate this value as
done in the other functions which call 'devm_pinctrl_register()'

Fixes: 0751bb5c44fe ("drm/tegra: dpaux: Add pinctrl support")

Signed-off-by: Christophe JAILLET <[email protected]>
---
drivers/gpu/drm/tegra/dpaux.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/gpu/drm/tegra/dpaux.c b/drivers/gpu/drm/tegra/dpaux.c
index 059f409556d5..2fde44c3a1b3 100644
--- a/drivers/gpu/drm/tegra/dpaux.c
+++ b/drivers/gpu/drm/tegra/dpaux.c
@@ -539,9 +539,9 @@ static int tegra_dpaux_probe(struct platform_device *pdev)
dpaux->desc.owner = THIS_MODULE;

dpaux->pinctrl = devm_pinctrl_register(&pdev->dev, &dpaux->desc, dpaux);
- if (!dpaux->pinctrl) {
+ if (IS_ERR(dpaux->pinctrl)) {
dev_err(&pdev->dev, "failed to register pincontrol\n");
- return -ENODEV;
+ return PTR_ERR(dpaux->pinctrl);
}
#endif
/* enable and clear all interrupts */
--
2.9.3


2016-10-31 11:50:17

by Jon Hunter

[permalink] [raw]
Subject: Re: [PATCH] drm/tegra: dpaux: Fix error handling


On 28/10/16 10:09, Christophe JAILLET wrote:
> 'devm_pinctrl_register()' returns an error pointer or a valid handle. So
> checking for NULL here is pointless and can never trigger.
>
> Check the returned value with IS_ERR instead and propagate this value as
> done in the other functions which call 'devm_pinctrl_register()'
>
> Fixes: 0751bb5c44fe ("drm/tegra: dpaux: Add pinctrl support")
>
> Signed-off-by: Christophe JAILLET <[email protected]>
> ---
> drivers/gpu/drm/tegra/dpaux.c | 4 ++--
> 1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/gpu/drm/tegra/dpaux.c b/drivers/gpu/drm/tegra/dpaux.c
> index 059f409556d5..2fde44c3a1b3 100644
> --- a/drivers/gpu/drm/tegra/dpaux.c
> +++ b/drivers/gpu/drm/tegra/dpaux.c
> @@ -539,9 +539,9 @@ static int tegra_dpaux_probe(struct platform_device *pdev)
> dpaux->desc.owner = THIS_MODULE;
>
> dpaux->pinctrl = devm_pinctrl_register(&pdev->dev, &dpaux->desc, dpaux);
> - if (!dpaux->pinctrl) {
> + if (IS_ERR(dpaux->pinctrl)) {
> dev_err(&pdev->dev, "failed to register pincontrol\n");
> - return -ENODEV;
> + return PTR_ERR(dpaux->pinctrl);
> }
> #endif
> /* enable and clear all interrupts */

Thanks for the fix!

Acked-by: Jon Hunter <[email protected]>

Cheers
Jon

--
nvpublic

2016-11-07 12:01:07

by Thierry Reding

[permalink] [raw]
Subject: Re: [PATCH] drm/tegra: dpaux: Fix error handling

On Fri, Oct 28, 2016 at 11:09:45AM +0200, Christophe JAILLET wrote:
> 'devm_pinctrl_register()' returns an error pointer or a valid handle. So
> checking for NULL here is pointless and can never trigger.
>
> Check the returned value with IS_ERR instead and propagate this value as
> done in the other functions which call 'devm_pinctrl_register()'
>
> Fixes: 0751bb5c44fe ("drm/tegra: dpaux: Add pinctrl support")
>
> Signed-off-by: Christophe JAILLET <[email protected]>
> ---
> drivers/gpu/drm/tegra/dpaux.c | 4 ++--
> 1 file changed, 2 insertions(+), 2 deletions(-)

Applied, thanks.

Thierry


Attachments:
(No filename) (613.00 B)
signature.asc (801.00 B)
Download all attachments