linux-fbdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Jingoo Han <jg1.han@samsung.com>
To: linux-fbdev@vger.kernel.org
Subject: Re: [patch] video: mmpfb: cleanup some static checker warnings in probe()
Date: Mon, 14 Apr 2014 08:49:15 +0000	[thread overview]
Message-ID: <000b01cf57be$6a22ebf0$3e68c3d0$%han@samsung.com> (raw)
In-Reply-To: <20140414080929.GB13372@mwanda>

On Monday, April 14, 2014 5:09 PM, Dan Carpenter wrote:
> 
> Sparse complains about using zero instead of NULL for pointers.
> Probably, if we enabled the warning, then GCC would complain about the
> unused initializers.  I've just removed them.
> 
> Smatch complains that we first check if "fbi" is NULL and then
> dereference it in the error handling.  It turns out that "fbi" can't be
> NULL so I've removed the check.

Yes, right.
'fbi' cannot be NULL, because 'info->par' is set as below.

./drivers/video/fbsysfs.c
struct fb_info *framebuffer_alloc(size_t size, struct device *dev)
{
.....
        info = (struct fb_info *) p;

        if (size)
                info->par = p + fb_info_size;

> 
> Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>

Reviewed-by: Jingoo Han <jg1.han@samsung.com>

Best regards,
Jingoo Han

> 
> diff --git a/drivers/video/fbdev/mmp/fb/mmpfb.c b/drivers/video/fbdev/mmp/fb/mmpfb.c
> index 7ab31eb..910fcc6 100644
> --- a/drivers/video/fbdev/mmp/fb/mmpfb.c
> +++ b/drivers/video/fbdev/mmp/fb/mmpfb.c
> @@ -554,8 +554,8 @@ static void fb_info_clear(struct fb_info *info)
>  static int mmpfb_probe(struct platform_device *pdev)
>  {
>  	struct mmp_buffer_driver_mach_info *mi;
> -	struct fb_info *info = 0;
> -	struct mmpfb_info *fbi = 0;
> +	struct fb_info *info;
> +	struct mmpfb_info *fbi;
>  	int ret, modes_num;
> 
>  	mi = pdev->dev.platform_data;
> @@ -569,10 +569,6 @@ static int mmpfb_probe(struct platform_device *pdev)
>  	if (info = NULL)
>  		return -ENOMEM;
>  	fbi = info->par;
> -	if (!fbi) {
> -		ret = -EINVAL;
> -		goto failed;
> -	}
> 
>  	/* init fb */
>  	fbi->fb_info = info;
> @@ -667,7 +663,6 @@ failed_free_buff:
>  		fbi->fb_start_dma);
>  failed_destroy_mutex:
>  	mutex_destroy(&fbi->access_ok);
> -failed:
>  	dev_err(fbi->dev, "mmp-fb: frame buffer device init failed\n");
> 
>  	framebuffer_release(info);


  reply	other threads:[~2014-04-14  8:49 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-04-14  8:09 [patch] video: mmpfb: cleanup some static checker warnings in probe() Dan Carpenter
2014-04-14  8:49 ` Jingoo Han [this message]
2014-04-30 10:58 ` Tomi Valkeinen

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='000b01cf57be$6a22ebf0$3e68c3d0$%han@samsung.com' \
    --to=jg1.han@samsung.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;
as well as URLs for NNTP newsgroup(s).