The Linux Kernel Mailing List
 help / color / mirror / Atom feed
From: Christophe JAILLET <christophe.jaillet@wanadoo.fr>
To: maxime.ripard@free-electrons.com, airlied@linux.ie, wens@csie.org
Cc: dri-devel@lists.freedesktop.org,
	linux-arm-kernel@lists.infradead.org,
	linux-kernel@vger.kernel.org, kernel-janitors@vger.kernel.org
Subject: Re: [PATCH] drm/sun4i: Fix error handling
Date: Sun, 30 Oct 2016 12:53:02 +0100	[thread overview]
Message-ID: <c15282b4-e88a-06b1-527d-96aedce8b7eb@wanadoo.fr> (raw)
In-Reply-To: <20161030084926.15303-1-christophe.jaillet@wanadoo.fr>

Hi,

BTW, memory allocation in 'sun4i_layers_init()' looks spurious, 
especially the use of 'layer' in the for loop.
Just my 2 cents.


I also forgot to say that we could propagate the error code returned by 
sun4i_layers_init instead of returning -EINVAL unconditionally

CJ




Le 30/10/2016 à 09:49, Christophe JAILLET a écrit :
> 'sun4i_layers_init()' returns an error pointer in case of error, not
> NULL. So test it with IS_ERR.
>
> Signed-off-by: Christophe JAILLET<christophe.jaillet@wanadoo.fr>
> ---
>   drivers/gpu/drm/sun4i/sun4i_drv.c | 2 +-
>   1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/gpu/drm/sun4i/sun4i_drv.c b/drivers/gpu/drm/sun4i/sun4i_drv.c
> index 9776f0305834..628712e6edd6 100644
> --- a/drivers/gpu/drm/sun4i/sun4i_drv.c
> +++ b/drivers/gpu/drm/sun4i/sun4i_drv.c
> @@ -143,7 +143,7 @@ static int sun4i_drv_bind(struct device *dev)
>   
>   	/* Create our layers */
>   	drv->layers = sun4i_layers_init(drm);
> -	if (!drv->layers) {
> +	if (IS_ERR(drv->layers)) {
>   		dev_err(drm->dev, "Couldn't create the planes\n");
>   		ret = -EINVAL;
>   		goto free_drm;

  reply	other threads:[~2016-10-30 11:53 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-10-30  8:49 [PATCH] drm/sun4i: Fix error handling Christophe JAILLET
2016-10-30 11:53 ` Christophe JAILLET [this message]
2016-11-02 18:14   ` Maxime Ripard
2016-11-05  6:15     ` Christophe JAILLET
2016-11-08 20:38       ` Maxime Ripard
2016-11-02 17:57 ` Maxime Ripard

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=c15282b4-e88a-06b1-527d-96aedce8b7eb@wanadoo.fr \
    --to=christophe.jaillet@wanadoo.fr \
    --cc=airlied@linux.ie \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=kernel-janitors@vger.kernel.org \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=maxime.ripard@free-electrons.com \
    --cc=wens@csie.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox