All of lore.kernel.org
 help / color / mirror / Atom feed
From: Punit Agrawal <punit.agrawal@arm.com>
To: u-boot@lists.denx.de
Subject: [U-Boot] [PATCH 1/1] video: rk3399_mipi: correct error checking
Date: Mon, 19 Mar 2018 17:21:08 +0000	[thread overview]
Message-ID: <87r2og2d8b.fsf@e105922-lin.cambridge.arm.com> (raw)
In-Reply-To: <20180318141810.22073-1-xypron.glpk@gmx.de> (Heinrich Schuchardt's message of "Sun, 18 Mar 2018 15:18:10 +0100")

Heinrich Schuchardt <xypron.glpk@gmx.de> writes:

> Pointers are never negative. Use macro IS_ERR() for checking.
> cf. rk3288_mipi.c
>
> Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
> ---
>  drivers/video/rockchip/rk3399_mipi.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/video/rockchip/rk3399_mipi.c b/drivers/video/rockchip/rk3399_mipi.c
> index 9ef202bf09..7560e0c07b 100644
> --- a/drivers/video/rockchip/rk3399_mipi.c
> +++ b/drivers/video/rockchip/rk3399_mipi.c
> @@ -128,7 +128,7 @@ static int rk_mipi_ofdata_to_platdata(struct udevice *dev)
>  	struct rk_mipi_priv *priv = dev_get_priv(dev);
>  
>  	priv->grf = syscon_get_first_range(ROCKCHIP_SYSCON_GRF);
> -	if (priv->grf <= 0) {
> +	if (!priv->grf || IS_ERR(priv->grf)) {

The above two checks can be combined into IS_ERR_OR_NULL().

>  		debug("%s: Get syscon grf failed (ret=%p)\n",
>  		      __func__, priv->grf);
>  		return  -ENXIO;

  parent reply	other threads:[~2018-03-19 17:21 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-03-18 14:18 [U-Boot] [PATCH 1/1] video: rk3399_mipi: correct error checking Heinrich Schuchardt
2018-03-18 16:12 ` [U-Boot] [U-Boot, " Philipp Tomsich
2018-03-18 16:13 ` Philipp Tomsich
2018-03-18 23:48 ` Philipp Tomsich
2018-03-19 17:21 ` Punit Agrawal [this message]
2018-03-19 17:22   ` [U-Boot] [PATCH " Dr. Philipp Tomsich

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=87r2og2d8b.fsf@e105922-lin.cambridge.arm.com \
    --to=punit.agrawal@arm.com \
    --cc=u-boot@lists.denx.de \
    /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.