From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755614AbcJ3LxO (ORCPT ); Sun, 30 Oct 2016 07:53:14 -0400 Received: from smtp04.smtpout.orange.fr ([80.12.242.126]:50223 "EHLO smtp.smtpout.orange.fr" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750831AbcJ3LxM (ORCPT ); Sun, 30 Oct 2016 07:53:12 -0400 X-ME-Helo: [127.0.0.1] X-ME-Date: Sun, 30 Oct 2016 12:53:09 +0100 X-ME-IP: 92.140.167.9 From: Christophe JAILLET Subject: Re: [PATCH] drm/sun4i: Fix error handling To: maxime.ripard@free-electrons.com, airlied@linux.ie, wens@csie.org References: <20161030084926.15303-1-christophe.jaillet@wanadoo.fr> X-Mozilla-News-Host: news://news.gmane.org Cc: dri-devel@lists.freedesktop.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, kernel-janitors@vger.kernel.org Newsgroups: gmane.linux.kernel.janitors,gmane.comp.video.dri.devel,gmane.linux.ports.arm.kernel,gmane.linux.kernel Message-ID: Date: Sun, 30 Oct 2016 12:53:02 +0100 User-Agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:45.0) Gecko/20100101 Thunderbird/45.4.0 MIME-Version: 1.0 In-Reply-To: <20161030084926.15303-1-christophe.jaillet@wanadoo.fr> Content-Type: text/plain; charset=windows-1252; format=flowed Content-Transfer-Encoding: 8bit X-Antivirus: avast! (VPS 161030-0, 30/10/2016), Outbound message X-Antivirus-Status: Clean Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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 > --- > 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;