From: liqiong <liqiong@nfschina.com>
To: Damien Le Moal <damien.lemoal@opensource.wdc.com>,
Sergei Shtylyov <sergei.shtylyov@gmail.com>,
Sergey Shtylyov <s.shtylyov@omp.ru>
Cc: linux-ide@vger.kernel.org, yuzhe@nfschina.com, renyu@nfschina.com
Subject: Re: [PATCH v2] ata: pata_pxa: handle failure of devm_ioremap()
Date: Mon, 13 Jun 2022 09:07:43 +0800 [thread overview]
Message-ID: <b062bab6-8248-e51a-c1ad-ac3fbc210e53@nfschina.com> (raw)
In-Reply-To: <097b7e93-4a85-1b6a-1772-67976f834108@opensource.wdc.com>
在 2022年06月13日 06:47, Damien Le Moal 写道:
> On 6/13/22 03:37, Sergei Shtylyov wrote:
>> On 6/12/22 3:57 PM, Li Qiong wrote:
>>
>>> As the possible failure of the devm_ioremap(), the return value
>>> could be NULL. Therefore it should be better to check it and
>>> print error message, return '-ENOMEM' error code.
> This error is very unlikely. So unless you are seeing actual problems in
> the field, I do not think it is worth fixing.
Agree, It's very unlikely.
This patch follows the guide of "KernelJanitors", wants to refine the code a little bit .
I searched and found that most of the other codes had checked the return value.
Actually, no actual bug relation to this patch.
Thanks,
Li Qiong
>
>>> Signed-off-by: Li Qiong <liqiong@nfschina.com>
>>> Reviewed-by: Sergey Shtylyov <s.shtylyov@omp.ru>
>>> ---
>>> v2:
>>> - add driver's name (pata_pxa) to subject.
>>> ---
>>> drivers/ata/pata_pxa.c | 5 +++++
>>> 1 file changed, 5 insertions(+)
>>>
>>> diff --git a/drivers/ata/pata_pxa.c b/drivers/ata/pata_pxa.c
>>> index 985f42c4fd70..cd1a8f37f920 100644
>>> --- a/drivers/ata/pata_pxa.c
>>> +++ b/drivers/ata/pata_pxa.c
>>> @@ -228,6 +228,11 @@ static int pxa_ata_probe(struct platform_device *pdev)
>>> ap->ioaddr.bmdma_addr = devm_ioremap(&pdev->dev, dma_res->start,
>>> resource_size(dma_res));
>> Looking again into this driver, this statement doesn't make sense: dma_res
>> points to a DMA resource, calling devm_ioremap() on it is just wrong... and
> Yes, having to do an ioremap of an IORESOURCE_DMA resource is rather
> unusual. dmaengine_slave_config() should be doing anything that is
> required for that resource.
>
>> 'ap->ioaddr.bmdma_addr' doesn;t seem to be used anyways...
> It is used in lbata-sff.c.
>
> A much cleaner fix would be to use
> devm_platform_get_and_ioremap_resource() or
> devm_platform_ioremap_resource() which will also remove the call to
> platform_get_resource((). But as mentioned above, unless this is fixing an
> actual bug in production, I do not think this is worth it.
>
>> MBR, Sergey
>
next prev parent reply other threads:[~2022-06-13 1:07 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-06-12 7:32 [PATCH] ata: handle failure of devm_ioremap() Li Qiong
2022-06-12 9:06 ` Sergey Shtylyov
2022-06-12 12:34 ` liqiong
2022-06-12 12:57 ` [PATCH v2] ata: pata_pxa: " Li Qiong
2022-06-12 18:37 ` Sergei Shtylyov
2022-06-12 22:47 ` Damien Le Moal
2022-06-13 1:07 ` liqiong [this message]
2022-06-13 11:50 ` Sergey Shtylyov
2022-06-13 11:56 ` Damien Le Moal
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=b062bab6-8248-e51a-c1ad-ac3fbc210e53@nfschina.com \
--to=liqiong@nfschina.com \
--cc=damien.lemoal@opensource.wdc.com \
--cc=linux-ide@vger.kernel.org \
--cc=renyu@nfschina.com \
--cc=s.shtylyov@omp.ru \
--cc=sergei.shtylyov@gmail.com \
--cc=yuzhe@nfschina.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