From: Marc Zyngier <marc.zyngier@arm.com>
To: Mukesh Ojha <mojha@codeaurora.org>,
tglx@linutronix.de, jason@lakedaemon.net,
yamada.masahiro@socionext.com,
linux-arm-kernel@lists.infradead.org,
linux-kernel@vger.kernel.org
Subject: Re: [PATCH 2/7] irqchip/irq-imgpdc.c: Use devm_platform_ioremap_resource()
Date: Mon, 29 Apr 2019 09:24:38 +0100 [thread overview]
Message-ID: <9650cf73-e592-c672-1951-10c137f1a3db@arm.com> (raw)
In-Reply-To: <c576ec64-9f07-b867-73c3-53df83b11b04@arm.com>
On 29/04/2019 09:13, Marc Zyngier wrote:
> On 04/04/2019 08:20, Mukesh Ojha wrote:
>> devm_platform_ioremap_resource() internally have platform_get_resource()
>> and devm_ioremap_resource() in it. So instead of calling them separately
>> use devm_platform_ioremap_resource() directly.
>>
>> Signed-off-by: Mukesh Ojha <mojha@codeaurora.org>
>> ---
>> drivers/irqchip/irq-imgpdc.c | 10 +---------
>> 1 file changed, 1 insertion(+), 9 deletions(-)
>>
>> diff --git a/drivers/irqchip/irq-imgpdc.c b/drivers/irqchip/irq-imgpdc.c
>> index d00489a..8904a5f 100644
>> --- a/drivers/irqchip/irq-imgpdc.c
>> +++ b/drivers/irqchip/irq-imgpdc.c
>> @@ -307,13 +307,6 @@ static int pdc_intc_probe(struct platform_device *pdev)
>> if (!node)
>> return -ENOENT;
>>
>> - /* Get registers */
>> - res_regs = platform_get_resource(pdev, IORESOURCE_MEM, 0);
>> - if (res_regs == NULL) {
>> - dev_err(&pdev->dev, "cannot find registers resource\n");
>> - return -ENOENT;
>> - }
>> -
>> /* Allocate driver data */
>> priv = devm_kzalloc(&pdev->dev, sizeof(*priv), GFP_KERNEL);
>> if (!priv) {
>> @@ -324,8 +317,7 @@ static int pdc_intc_probe(struct platform_device *pdev)
>> platform_set_drvdata(pdev, priv);
>>
>> /* Ioremap the registers */
>> - priv->pdc_base = devm_ioremap(&pdev->dev, res_regs->start,
>> - resource_size(res_regs));
>> + priv->pdc_base = devm_platform_ioremap_resource(pdev, 0);
>> if (!priv->pdc_base)
>> return -EIO;
>>
>>
>
> What happens to the res_regs variable then?
>
> Also, and more importantly, devm_platform_ioremap_resource doesn't
> return NULL on error, but an ERR_PTR. Yes, the bug was already there,
> but since you're changing it, you might as well fix the thing.
Actually, the current code is right, and you're actively breaking it. Boo.
M.
--
Jazz is not dead. It just smells funny...
next prev parent reply other threads:[~2019-04-29 8:24 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-04-04 7:20 [PATCH 0/7] irqchip: Use devm_platform_ioremap_resource() Mukesh Ojha
2019-04-04 7:20 ` [PATCH 1/7] irqchip/irq-uniphier-aidet: " Mukesh Ojha
2019-04-04 7:20 ` [PATCH 2/7] irqchip/irq-imgpdc.c: " Mukesh Ojha
2019-04-29 8:13 ` Marc Zyngier
2019-04-29 8:24 ` Marc Zyngier [this message]
2019-04-04 7:20 ` [PATCH 3/7] irqchip/irq-ts4800.c: " Mukesh Ojha
2019-04-04 7:20 ` [PATCH 4/7] irqchip/irq-mbigen.c: " Mukesh Ojha
2019-04-29 8:16 ` Marc Zyngier
2019-04-04 7:20 ` [PATCH 5/7] irqchip/irq-mvebu-icu: " Mukesh Ojha
2019-04-04 7:20 ` [PATCH 6/7] irqchip/irq-mvebu-pic: " Mukesh Ojha
2019-04-04 7:20 ` [PATCH 7/7] irqchip/irq-mvebu-sei: " Mukesh Ojha
2019-04-29 8:19 ` Marc Zyngier
2019-04-29 8:27 ` [PATCH 0/7] irqchip: " Marc Zyngier
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=9650cf73-e592-c672-1951-10c137f1a3db@arm.com \
--to=marc.zyngier@arm.com \
--cc=jason@lakedaemon.net \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-kernel@vger.kernel.org \
--cc=mojha@codeaurora.org \
--cc=tglx@linutronix.de \
--cc=yamada.masahiro@socionext.com \
/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).