From: Thierry Reding <thierry.reding-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
To: Wei Yongjun <weiyj.lk-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
Cc: tbergstrom-DDmLM1+adcrQT0dZR+AlfA@public.gmane.org,
airlied-cv59FeDIM0c@public.gmane.org,
swarren-3lzwWm7+Weoh9ZMKESR00Q@public.gmane.org,
grant.likely-QSEj5FYQhm4dnm+yROfE0A@public.gmane.org,
rob.herring-bsGFqQB8/DxBDgjK7y7TUQ@public.gmane.org,
yongjun_wei-zrsr2BFq86L20UzCJQGyNP8+0UxHXcjY@public.gmane.org,
dri-devel-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW@public.gmane.org,
linux-tegra-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
Subject: Re: [PATCH -next] drm/tegra: fix return value check
Date: Mon, 28 Oct 2013 09:53:59 +0100 [thread overview]
Message-ID: <20131028085358.GC10718@ulmo.nvidia.com> (raw)
In-Reply-To: <CAPgLHd_JqYS5DC4tmzgGVEYmJpeM96FAEDvmM3cUUep+1jj7mA-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
[-- Attachment #1: Type: text/plain, Size: 1667 bytes --]
On Mon, Oct 21, 2013 at 11:34:07AM +0800, Wei Yongjun wrote:
> From: Wei Yongjun <yongjun_wei-zrsr2BFq86L20UzCJQGyNP8+0UxHXcjY@public.gmane.org>
>
> In case of error, the function clk_get_parent() and devm_ioremap_resource()
> returns ERR_PTR() and never returns NULL. The NULL test in the return value
> check should be replaced with IS_ERR().
>
> Signed-off-by: Wei Yongjun <yongjun_wei-zrsr2BFq86L20UzCJQGyNP8+0UxHXcjY@public.gmane.org>
> ---
> drivers/gpu/drm/tegra/dsi.c | 6 +++---
> 1 file changed, 3 insertions(+), 3 deletions(-)
I've applied this, but with the first hunk removed, since looking at the
implementation of clk_get_parent() it can actually return NULL. In fact
it seems like it will never return ERR_PTR().
I've also updated the commit message to reflect that.
Thierry
>
> diff --git a/drivers/gpu/drm/tegra/dsi.c b/drivers/gpu/drm/tegra/dsi.c
> index 1cfbace..7bc2eeb 100644
> --- a/drivers/gpu/drm/tegra/dsi.c
> +++ b/drivers/gpu/drm/tegra/dsi.c
> @@ -914,7 +914,7 @@ static int tegra_dsi_setup_clocks(struct tegra_dsi *dsi)
> int err;
>
> parent = clk_get_parent(dsi->clk);
> - if (!parent)
> + if (IS_ERR(parent))
> return -EINVAL;
>
> err = clk_set_parent(parent, dsi->clk_parent);
> @@ -969,8 +969,8 @@ static int tegra_dsi_probe(struct platform_device *pdev)
>
> regs = platform_get_resource(pdev, IORESOURCE_MEM, 0);
> dsi->regs = devm_ioremap_resource(&pdev->dev, regs);
> - if (!dsi->regs)
> - return -EADDRNOTAVAIL;
> + if (IS_ERR(dsi->regs))
> + return PTR_ERR(dsi->regs);
>
> INIT_LIST_HEAD(&dsi->client.list);
> dsi->client.ops = &dsi_client_ops;
>
[-- Attachment #2: Type: application/pgp-signature, Size: 836 bytes --]
next prev parent reply other threads:[~2013-10-28 8:53 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-10-21 3:34 [PATCH -next] drm/tegra: fix return value check Wei Yongjun
[not found] ` <CAPgLHd_JqYS5DC4tmzgGVEYmJpeM96FAEDvmM3cUUep+1jj7mA-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2013-10-28 8:53 ` Thierry Reding [this message]
[not found] ` <20131028085358.GC10718-AwZRO8vwLAwmlAP/+Wk3EA@public.gmane.org>
2013-10-28 21:51 ` Stephen Warren
[not found] ` <526EDC64.5050202-3lzwWm7+Weoh9ZMKESR00Q@public.gmane.org>
2013-10-28 22:38 ` Thierry Reding
2013-10-28 22:48 ` Stephen Warren
[not found] ` <526EE9C8.4080308-3lzwWm7+Weoh9ZMKESR00Q@public.gmane.org>
2013-10-28 23:04 ` Thierry Reding
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20131028085358.GC10718@ulmo.nvidia.com \
--to=thierry.reding-re5jqeeqqe8avxtiumwx3w@public.gmane.org \
--cc=airlied-cv59FeDIM0c@public.gmane.org \
--cc=dri-devel-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW@public.gmane.org \
--cc=grant.likely-QSEj5FYQhm4dnm+yROfE0A@public.gmane.org \
--cc=linux-tegra-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
--cc=rob.herring-bsGFqQB8/DxBDgjK7y7TUQ@public.gmane.org \
--cc=swarren-3lzwWm7+Weoh9ZMKESR00Q@public.gmane.org \
--cc=tbergstrom-DDmLM1+adcrQT0dZR+AlfA@public.gmane.org \
--cc=weiyj.lk-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org \
--cc=yongjun_wei-zrsr2BFq86L20UzCJQGyNP8+0UxHXcjY@public.gmane.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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.