From: Yang Yingliang <yangyingliang@huawei.com>
To: Hauke Mehrtens <hauke@hauke-m.de>, <linux-kernel@vger.kernel.org>,
<netdev@vger.kernel.org>
Cc: <davem@davemloft.net>, <kuba@kernel.org>
Subject: Re: [PATCH net-next] net: lantiq: Use devm_platform_get_and_ioremap_resource()
Date: Sat, 5 Jun 2021 19:55:43 +0800 [thread overview]
Message-ID: <0a76bc60-4ce3-e8ec-10b5-56faaf65b58e@huawei.com> (raw)
In-Reply-To: <a66836af-99a4-9bc1-3c0c-6cb9bb1cc4d9@hauke-m.de>
On 2021/6/5 18:58, Hauke Mehrtens wrote:
> On 6/5/21 11:26 AM, Yang Yingliang wrote:
>> Use devm_platform_get_and_ioremap_resource() to simplify
>> code.
>>
>> Signed-off-by: Yang Yingliang <yangyingliang@huawei.com>
>> ---
>> drivers/net/ethernet/lantiq_xrx200.c | 8 +-------
>> 1 file changed, 1 insertion(+), 7 deletions(-)
>>
>> diff --git a/drivers/net/ethernet/lantiq_xrx200.c
>> b/drivers/net/ethernet/lantiq_xrx200.c
>> index 36dc3e5f6218..003df49e40b1 100644
>> --- a/drivers/net/ethernet/lantiq_xrx200.c
>> +++ b/drivers/net/ethernet/lantiq_xrx200.c
>> @@ -456,13 +456,7 @@ static int xrx200_probe(struct platform_device
>> *pdev)
>> net_dev->max_mtu = XRX200_DMA_DATA_LEN;
>> /* load the memory ranges */
>> - res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
>> - if (!res) {
>> - dev_err(dev, "failed to get resources\n");
>> - return -ENOENT;
>> - }
>> -
>> - priv->pmac_reg = devm_ioremap_resource(dev, res);
>> + priv->pmac_reg = devm_platform_get_and_ioremap_resource(pdev, 0,
>> &res);
>
> res is not used anywhere else, you can provide NULL instead of res and
> remove the variable.
>
> priv->pmac_reg = devm_platform_get_and_ioremap_resource(pdev, 0, NULL);
OK, thanks for your suggestion.
>
>> if (IS_ERR(priv->pmac_reg))
>> return PTR_ERR(priv->pmac_reg);
>>
>
prev parent reply other threads:[~2021-06-05 11:55 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-06-05 9:26 Yang Yingliang
2021-06-05 10:58 ` Hauke Mehrtens
2021-06-05 11:55 ` Yang Yingliang [this message]
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=0a76bc60-4ce3-e8ec-10b5-56faaf65b58e@huawei.com \
--to=yangyingliang@huawei.com \
--cc=davem@davemloft.net \
--cc=hauke@hauke-m.de \
--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®