mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Yang Yingliang <yangyingliang@huawei.com>
To: Andrew Lunn <andrew@lunn.ch>
Cc: <linux-kernel@vger.kernel.org>, <netdev@vger.kernel.org>,
	<davem@davemloft.net>, <kuba@kernel.org>
Subject: Re: [PATCH net-next] net: mdio: mscc-miim: Use devm_platform_get_and_ioremap_resource()
Date: Fri, 11 Jun 2021 09:35:04 +0800	[thread overview]
Message-ID: <fd9cbc9c-478e-85c8-62ec-58a8baf4333c@huawei.com> (raw)
In-Reply-To: <YMI3VsR/jnVVhmsh@lunn.ch>

Hi,

On 2021/6/11 0:01, Andrew Lunn wrote:
>> -	dev->regs = devm_ioremap_resource(&pdev->dev, res);
>> +	dev->regs = devm_platform_get_and_ioremap_resource(pdev, 0, &res);
>>   	if (IS_ERR(dev->regs)) {
> Here, only dev->regs is considered.
>
>>   		dev_err(&pdev->dev, "Unable to map MIIM registers\n");
>>   		return PTR_ERR(dev->regs);
>>   	}
>
>
>> +	dev->phy_regs = devm_platform_get_and_ioremap_resource(pdev, 1, &res);
>> +	if (res && IS_ERR(dev->phy_regs)) {
> Here you look at both res and dev->phy_regs.
>
> This seems inconsistent. Can devm_platform_get_and_ioremap_resource()
> return success despite res being NULL?
No, if res is NULL, devm_platform_get_and_ioremap_resource() returns failed.
But, before this patch, if the internal phy res is NULL, it doesn't 
return error
code, so I checked the res to make sure it doesn't change the origin 
code logic.

Thanks,
Yang
>
>         Andrew
> .

  reply	other threads:[~2021-06-11  1:35 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-06-10  9:11 Yang Yingliang
2021-06-10 16:01 ` Andrew Lunn
2021-06-11  1:35   ` Yang Yingliang [this message]
2021-06-11  3:35     ` Andrew Lunn

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=fd9cbc9c-478e-85c8-62ec-58a8baf4333c@huawei.com \
    --to=yangyingliang@huawei.com \
    --cc=andrew@lunn.ch \
    --cc=davem@davemloft.net \
    --cc=kuba@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=netdev@vger.kernel.org \
    /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

all inboxes | Powered by JetHome®