From patchwork Tue Oct 20 08:52:15 2009 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Artem Bityutskiy X-Patchwork-Id: 36453 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from bombadil.infradead.org (bombadil.infradead.org [18.85.46.34]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (Client did not present a certificate) by ozlabs.org (Postfix) with ESMTPS id AC128B7B68 for ; Tue, 20 Oct 2009 19:55:07 +1100 (EST) Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.69 #1 (Red Hat Linux)) id 1N0ASk-00087j-0h; Tue, 20 Oct 2009 08:53:02 +0000 Received: from smtp.nokia.com ([192.100.122.230] helo=mgw-mx03.nokia.com) by bombadil.infradead.org with esmtps (Exim 4.69 #1 (Red Hat Linux)) id 1N0ASb-000877-WF for linux-mtd@lists.infradead.org; Tue, 20 Oct 2009 08:52:58 +0000 Received: from vaebh106.NOE.Nokia.com (vaebh106.europe.nokia.com [10.160.244.32]) by mgw-mx03.nokia.com (Switch-3.3.3/Switch-3.3.3) with ESMTP id n9K8qSKj030133; Tue, 20 Oct 2009 11:52:49 +0300 Received: from vaebh104.NOE.Nokia.com ([10.160.244.30]) by vaebh106.NOE.Nokia.com with Microsoft SMTPSVC(6.0.3790.3959); Tue, 20 Oct 2009 11:52:19 +0300 Received: from mgw-da02.ext.nokia.com ([147.243.128.26]) by vaebh104.NOE.Nokia.com over TLS secured channel with Microsoft SMTPSVC(6.0.3790.3959); Tue, 20 Oct 2009 11:52:18 +0300 Received: from [172.21.40.36] (esdhcp04036.research.nokia.com [172.21.40.36]) by mgw-da02.ext.nokia.com (Switch-3.3.3/Switch-3.3.3) with ESMTP id n9K8qFq7032669; Tue, 20 Oct 2009 11:52:16 +0300 Subject: Re: [PATCH] mtd_blkdevs.c: quiet a "symbol shadows" sparse warning From: Artem Bityutskiy To: H Hartley Sweeten In-Reply-To: References: Date: Tue, 20 Oct 2009 11:52:15 +0300 Message-Id: <1256028735.29856.142.camel@localhost> Mime-Version: 1.0 X-Mailer: Evolution 2.26.3 (2.26.3-1.fc11) X-OriginalArrivalTime: 20 Oct 2009 08:52:19.0086 (UTC) FILETIME=[A17402E0:01CA5162] X-Nokia-AV: Clean X-CRM114-Version: 20090807-BlameThorstenAndJenny ( TRE 0.7.6 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20091020_045254_422200_8C7295E2 X-CRM114-Status: GOOD ( 19.69 ) X-Spam-Score: -4.0 (----) X-Spam-Report: SpamAssassin version 3.2.5 on bombadil.infradead.org summary: Content analysis details: (-4.0 points) pts rule name description ---- ---------------------- -------------------------------------------------- -4.0 RCVD_IN_DNSWL_MED RBL: Sender listed at http://www.dnswl.org/, medium trust [192.100.122.230 listed in list.dnswl.org] Cc: linux-mtd@lists.infradead.org X-BeenThere: linux-mtd@lists.infradead.org X-Mailman-Version: 2.1.12 Precedence: list Reply-To: dedekind1@gmail.com List-Id: Linux MTD discussion mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: linux-mtd-bounces@lists.infradead.org Errors-To: linux-mtd-bounces+incoming=patchwork.ozlabs.org@lists.infradead.org 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 > > --- > > 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 Signed-off-by: Artem Bityutskiy -------------------------- 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 Signed-off-by: Artem Bityutskiy -------------------------- 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 kfree(tr->blkcore_priv); Here is the tree: http://git.infradead.org/users/dedekind/l2-mtd-2.6.git 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);