From: Artem Bityutskiy <dedekind1@gmail.com>
To: Julia Lawall <Julia.Lawall@lip6.fr>, Stefan Roese <sr@denx.de>,
Shiraz Hashim <shiraz.hashim@st.com>
Cc: kernel-janitors@vger.kernel.org,
David Woodhouse <dwmw2@infradead.org>,
linux-kernel@vger.kernel.org, linux-mtd@lists.infradead.org
Subject: Re: [PATCH] drivers/mtd/devices/spear_smi.c: use devm_ functions consistently
Date: Fri, 24 Aug 2012 14:35:04 +0300 [thread overview]
Message-ID: <1345808104.2848.285.camel@sauron.fi.intel.com> (raw)
In-Reply-To: <1344112598-1051-1-git-send-email-Julia.Lawall@lip6.fr>
[-- Attachment #1: Type: text/plain, Size: 2556 bytes --]
[See here for the original patch:
http://lists.infradead.org/pipermail/linux-mtd/2012-August/043112.html]
Julia, sorry for long delay,
aiaiai gives says that this patch introduced 3 warnings:
--------------------------------------------------------------------------------
Successfully built configuration "arm-spear6xx_defconfig,arm,arm-unknown-linux-gnueabi-", results:
--- before_patching.log
+++ after_patching.log
@@ @@
-drivers/mtd/devices/spear_smi.c: In function 'spear_smi_remove':
-drivers/mtd/devices/spear_smi.c:1022:30: warning: variable 'pdata' set but not used [-Wunused-but-set-variable]
+drivers/mtd/devices/spear_smi.c: In function 'spear_smi_remove':
+drivers/mtd/devices/spear_smi.c:1026:9: warning: variable 'irq' set but not used [-Wunused-but-set-variable]
+drivers/mtd/devices/spear_smi.c:1022:30: warning: variable 'pdata' set but not used [-Wunused-but-set-variable]
+drivers/mtd/devices/spear_smi.c:1024:19: warning: variable 'smi_base' set but not used [-Wunused-but-set-variable]
--------------------------------------------------------------------------------
On Sat, 2012-08-04 at 22:36 +0200, Julia Lawall wrote:
> From: Julia Lawall <Julia.Lawall@lip6.fr>
>
> Use devm_kzalloc for all calls to kzalloc and not just the first. Use devm
> functions for other allocations as well.
>
> Move the call to platform_get_resource(pdev, IORESOURCE_MEM, 0) closer to
> where its result is passed to devm_request_and_ioremap to make the lack of
> need for a NULL test more evident.
>
> The semantic match that finds the inconsistency is as follows:
> (http://coccinelle.lip6.fr/)
...
> @@ -1073,21 +1043,13 @@ static int __devexit spear_smi_remove(struct platform_device *pdev)
> ret = mtd_device_unregister(&flash->mtd);
> if (ret)
> dev_err(&pdev->dev, "error removing mtd\n");
> -
> - iounmap(flash->base_addr);
> - kfree(flash);
> }
>
> irq = platform_get_irq(pdev, 0);
> - free_irq(irq, dev);
I guess 'platform_get_irq()' should be killed as well? Stefan, this is
strange code - we get irq, without checking for error, and then free it?
What is the rationale?
> clk_disable_unprepare(dev->clk);
> - clk_put(dev->clk);
> - iounmap(dev->io_base);
> - kfree(dev);
>
> smi_base = platform_get_resource(pdev, IORESOURCE_MEM, 0);
> - release_mem_region(smi_base->start, resource_size(smi_base));
> platform_set_drvdata(pdev, NULL);
Why do we set platform data to NULL, is this needed?
--
Best Regards,
Artem Bityutskiy
[-- Attachment #2: This is a digitally signed message part --]
[-- Type: application/pgp-signature, Size: 836 bytes --]
next prev parent reply other threads:[~2012-08-24 11:30 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-08-04 20:36 [PATCH] drivers/mtd/devices/spear_smi.c: use devm_ functions consistently Julia Lawall
2012-08-24 11:35 ` Artem Bityutskiy [this message]
2012-08-24 13:14 ` Stefan Roese
2012-08-24 14:43 ` Artem Bityutskiy
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=1345808104.2848.285.camel@sauron.fi.intel.com \
--to=dedekind1@gmail.com \
--cc=Julia.Lawall@lip6.fr \
--cc=dwmw2@infradead.org \
--cc=kernel-janitors@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mtd@lists.infradead.org \
--cc=shiraz.hashim@st.com \
--cc=sr@denx.de \
/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