[PATCH] mtd_blkdevs.c: quiet a "symbol shadows" sparse warning

Artem Bityutskiy dedekind1 at gmail.com
Tue Oct 20 04:52:15 EDT 2009


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 at 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 at 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 at visionengravers.com>
Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy at 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 at visionengravers.com>
Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy at 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 at 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 at 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 (Артём Битюцкий)




More information about the linux-mtd mailing list