All of lore.kernel.org
 help / color / mirror / Atom feed
From: Artem Bityutskiy <dedekind1@gmail.com>
To: H Hartley Sweeten <hartleys@visionengravers.com>
Cc: linux-mtd@lists.infradead.org
Subject: Re: [PATCH] mtd_blkdevs.c: quiet a "symbol shadows" sparse warning
Date: Tue, 20 Oct 2009 11:52:15 +0300	[thread overview]
Message-ID: <1256028735.29856.142.camel@localhost> (raw)
In-Reply-To: <BD79186B4FD85F4B8E60E381CAEE190901E2455C@mi8nycmail19.Mi8.com>

On Fri, 2009-10-16 at 18:52 -0400, H Hartley Sweeten wrote:
> In register_mtd_blktrans(), the symbol 'ret' is already declared
> as an int at the start of the function.  The inner loop declaration
> is unnecessary.  Quiets the following sparse warning:
> 
>   warning: symbol 'ret' shadows an earlier one
> 
> Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com>
> 
> ---
> 
> diff --git a/drivers/mtd/mtd_blkdevs.c b/drivers/mtd/mtd_blkdevs.c
> index 8ca17a3..b76d6e5 100644
> --- a/drivers/mtd/mtd_blkdevs.c
> +++ b/drivers/mtd/mtd_blkdevs.c
> @@ -379,7 +379,7 @@ int register_mtd_blktrans(struct mtd_blktrans_ops *tr)
>  	tr->blkcore_priv->thread = kthread_run(mtd_blktrans_thread, tr,
>  			"%sd", tr->name);
>  	if (IS_ERR(tr->blkcore_priv->thread)) {
> -		int ret = PTR_ERR(tr->blkcore_priv->thread);
> +		ret = PTR_ERR(tr->blkcore_priv->thread);
>  		blk_cleanup_queue(tr->blkcore_priv->rq);
>  		unregister_blkdev(tr->major, tr->name);
>  		kfree(tr->blkcore_priv); 

Applied to my l2-mtd-2.6.git. It starts sound silly, but again this did
not apply cleanly:

[dedekind@eru l2-mtd-2.6.git]$ git am -i -s
sweeten                                                                                                                  
Commit Body
is:                                                                                                                                                      
--------------------------                                                                                                                                           
mtd_blkdevs.c: quiet a "symbol shadows" sparse
warning                                                                                                               

In register_mtd_blktrans(), the symbol 'ret' is already declared
as an int at the start of the function.  The inner loop declaration
is unnecessary.  Quiets the following sparse warning:              

  warning: symbol 'ret' shadows an earlier one

Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com>
Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>   
--------------------------                                     
Apply? [y]es/[n]o/[e]dit/[v]iew patch/[a]ccept all e           
Commit Body is:                                                
--------------------------                                     
mtd: blkdevs: quiet a "symbol shadows" sparse warning          

In register_mtd_blktrans(), the symbol 'ret' is already declared
as an int at the start of the function.  The inner loop declaration
is unnecessary.  Quiets the following sparse warning:              

  warning: symbol 'ret' shadows an earlier one

Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com>
Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>   
--------------------------                                     
Apply? [y]es/[n]o/[e]dit/[v]iew patch/[a]ccept all y           
Applying: mtd: blkdevs: quiet a "symbol shadows" sparse warning
error: patch failed: drivers/mtd/mtd_blkdevs.c:379             
error: drivers/mtd/mtd_blkdevs.c: patch does not apply         
Patch failed at 0001 mtd: blkdevs: quiet a "symbol shadows" sparse
warning
When you have resolved this problem run "git am -i
--resolved".           
If you would prefer to skip this patch, instead run "git am -i
--skip".   
To restore the original branch and stop patching run "git am -i
--abort". 
[dedekind@eru l2-mtd-2.6.git]$ patch -p1 < .git/rebase-apply/patch 
patching file drivers/mtd/mtd_blkdevs.c                            
Hunk #1 succeeded at 388 with fuzz 1 (offset 9 lines).             
[dedekind@eru l2-mtd-2.6.git]$ git diff                            
diff --git a/drivers/mtd/mtd_blkdevs.c b/drivers/mtd/mtd_blkdevs.c 
index 0acbf4f..955226d 100644                                      
--- a/drivers/mtd/mtd_blkdevs.c                                    
+++ b/drivers/mtd/mtd_blkdevs.c                                    
@@ -388,7 +388,7 @@ int register_mtd_blktrans(struct mtd_blktrans_ops
*tr)
        tr->blkcore_priv->thread = kthread_run(mtd_blktrans_thread, tr,
                        "%sd", tr->name);
        if (IS_ERR(tr->blkcore_priv->thread)) {
-               int ret = PTR_ERR(tr->blkcore_priv->thread);
+               ret = PTR_ERR(tr->blkcore_priv->thread);
                blk_cleanup_queue(tr->blkcore_priv->rq);
                unregister_blkdev(tr->major, tr->name);
                kfree(tr->blkcore_priv);

Here is the tree:
http://git.infradead.org/users/dedekind/l2-mtd-2.6.git

-- 
Best Regards,
Artem Bityutskiy (Артём Битюцкий)

      reply	other threads:[~2009-10-20  8:52 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-10-16 22:52 [PATCH] mtd_blkdevs.c: quiet a "symbol shadows" sparse warning H Hartley Sweeten
2009-10-20  8:52 ` Artem Bityutskiy [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=1256028735.29856.142.camel@localhost \
    --to=dedekind1@gmail.com \
    --cc=hartleys@visionengravers.com \
    --cc=linux-mtd@lists.infradead.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.