mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Dan Carpenter <dan.carpenter@linaro.org>
To: "Uwe Kleine-König" <u.kleine-koenig@baylibre.com>
Cc: Alex Lanzano <lanzano.alex@gmail.com>,
	Maarten Lankhorst <maarten.lankhorst@linux.intel.com>,
	Maxime Ripard <mripard@kernel.org>,
	Thomas Zimmermann <tzimmermann@suse.de>,
	David Airlie <airlied@gmail.com>, Simona Vetter <simona@ffwll.ch>,
	Dmitry Baryshkov <dmitry.baryshkov@linaro.org>,
	Mehdi Djait <mehdi.djait@bootlin.com>,
	dri-devel@lists.freedesktop.org, linux-kernel@vger.kernel.org,
	kernel-janitors@vger.kernel.org
Subject: Re: [PATCH next] drm/sharp-memory: Fix some checks in sharp_memory_probe()
Date: Fri, 25 Oct 2024 10:30:44 +0300	[thread overview]
Message-ID: <3c078224-071e-4dd9-bf8d-51dbd0f2a9b2@stanley.mountain> (raw)
In-Reply-To: <hojly7qagyszxbgonzqmuuxucdfqwovrjyiktdxpibku6yodum@n7algnce2tts>

On Thu, Oct 24, 2024 at 11:08:05PM +0200, Uwe Kleine-König wrote:
> On Wed, Oct 23, 2024 at 11:30:31AM +0300, Dan Carpenter wrote:
> > The devm_drm_dev_alloc() function returns error pointers, it never
> > returns NULL.  Change that check to IS_ERR().
> > 
> > The devm_gpiod_get_optional() function returns a mix of error pointers
> > if there is an error, or NULL if there is no GPIO assigned.  Add a check
> > for error pointers.
> > 
> > Fixes: b8f9f21716fe ("drm/tiny: Add driver for Sharp Memory LCD")
> > Signed-off-by: Dan Carpenter <dan.carpenter@linaro.org>
> > ---
> >  drivers/gpu/drm/tiny/sharp-memory.c | 6 ++++--
> >  1 file changed, 4 insertions(+), 2 deletions(-)
> > 
> > diff --git a/drivers/gpu/drm/tiny/sharp-memory.c b/drivers/gpu/drm/tiny/sharp-memory.c
> > index 2d2315bd6aef..1bcdd79166a4 100644
> > --- a/drivers/gpu/drm/tiny/sharp-memory.c
> > +++ b/drivers/gpu/drm/tiny/sharp-memory.c
> > @@ -543,8 +543,8 @@ static int sharp_memory_probe(struct spi_device *spi)
> >  
> >  	smd = devm_drm_dev_alloc(dev, &sharp_memory_drm_driver,
> >  				 struct sharp_memory_device, drm);
> > -	if (!smd)
> > -		return -ENOMEM;
> > +	if (IS_ERR(smd))
> > +		return PTR_ERR(smd);
> >  
> >  	spi_set_drvdata(spi, smd);
> >  
> > @@ -555,6 +555,8 @@ static int sharp_memory_probe(struct spi_device *spi)
> >  		return dev_err_probe(dev, ret, "Failed to initialize drm config\n");
> >  
> >  	smd->enable_gpio = devm_gpiod_get_optional(dev, "enable", GPIOD_OUT_HIGH);
> > +	if (IS_ERR(smd->enable_gpio))
> > +		return PTR_ERR(smd->enable_gpio);
> >  	if (!smd->enable_gpio)
> >  		dev_warn(dev, "Enable gpio not defined\n");
> 
> Use dev_err_probe() instead of plain returns?
> 

Sure.  Let me resend.

regards,
dan carpenter


      reply	other threads:[~2024-10-25  7:30 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-10-23  8:30 Dan Carpenter
2024-10-23 13:49 ` Alex Lanzano
2024-10-24 21:08 ` Uwe Kleine-König
2024-10-25  7:30   ` Dan Carpenter [this message]

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=3c078224-071e-4dd9-bf8d-51dbd0f2a9b2@stanley.mountain \
    --to=dan.carpenter@linaro.org \
    --cc=airlied@gmail.com \
    --cc=dmitry.baryshkov@linaro.org \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=kernel-janitors@vger.kernel.org \
    --cc=lanzano.alex@gmail.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=maarten.lankhorst@linux.intel.com \
    --cc=mehdi.djait@bootlin.com \
    --cc=mripard@kernel.org \
    --cc=simona@ffwll.ch \
    --cc=tzimmermann@suse.de \
    --cc=u.kleine-koenig@baylibre.com \
    /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

all inboxes | Powered by JetHome®