public inbox for kernel-janitors@vger.kernel.org
 help / color / mirror / Atom feed
From: Dan Carpenter <error27@gmail.com>
To: linux-fbdev@vger.kernel.org
Subject: Re: [patch] fbdev: sh_mobile_lcdc: checking NULL instead of
Date: Mon, 21 Mar 2011 04:39:25 +0000	[thread overview]
Message-ID: <20110321043925.GO2008@bicker> (raw)
In-Reply-To: <20110319043647.GZ2008@bicker>

On Mon, Mar 21, 2011 at 09:47:50AM +0530, Janorkar, Mayuresh wrote:
> > backlight_device_register() returns an ERR_PTR.  It doesn't return NULL.
> 
> The patch is not applying on the master branch of fbdev tree.
> I could find another branch: 	fbdev/shmobile on the tree.
> It is a good idea to mention this in the description of the patch.
> 

Sorry, I'm working against linux-next so I wasn't aware.

> > 
> > Signed-off-by: Dan Carpenter <error27@gmail.com>
> > 
> > diff --git a/drivers/video/sh_mobile_lcdcfb.c
> > b/drivers/video/sh_mobile_lcdcfb.c
> > index bf2629f..a53abe1 100644
> > --- a/drivers/video/sh_mobile_lcdcfb.c
> > +++ b/drivers/video/sh_mobile_lcdcfb.c
> > @@ -1088,7 +1088,7 @@ static struct backlight_device
> > *sh_mobile_lcdc_bl_probe(struct device *parent,
> > 
> >  	bl = backlight_device_register(ch->cfg.bl_info.name, parent, ch,
> >  				       &sh_mobile_lcdc_bl_ops, NULL);
> > -	if (!bl) {
> > +	if (IS_ERR(bl)) {
> >  		dev_err(parent, "unable to register backlight device\n");
> 
> 
> How about printing the error number here?
> 

Ok.  That's a good idea.

> >  		return NULL;
> 
> Code is not checking for return value where this function is called.
> 
> A code snippet where this function is called:
> /* probe the backlight is there is one defined */
>                  if (ch->cfg.bl_info.max_brightness)
>                        ch->bl = sh_mobile_lcdc_bl_probe(&pdev->dev, ch);
> 
> If the return value is not checked then whats the use of return value?
> 

It is checked actually.  Look at the places which would dereference
->bl.

> >  	}
> > --
> > To unsubscribe from this list: send the line "unsubscribe linux-fbdev" in
> > the body of a message to majordomo@vger.kernel.org
> > More majordomo info at  http://vger.kernel.org/majordomo-info.html

  parent reply	other threads:[~2011-03-21  4:39 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-03-19  4:36 [patch] fbdev: sh_mobile_lcdc: checking NULL instead of IS_ERR() Dan Carpenter
2011-03-21  4:29 ` Janorkar, Mayuresh
2011-03-21  4:39 ` Dan Carpenter [this message]
2011-03-21  5:43 ` Janorkar, Mayuresh

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=20110321043925.GO2008@bicker \
    --to=error27@gmail.com \
    --cc=linux-fbdev@vger.kernel.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