From: Felipe Balbi <balbi@kernel.org>
To: Tang Bin <tangbin@cmss.chinamobile.com>,
Greg KH <gregkh@linuxfoundation.org>
Cc: linux-usb@vger.kernel.org, linux-kernel@vger.kernel.org,
Florian Fainelli <f.fainelli@gmail.com>
Subject: Re: [PATCH] usb: bdc: Remove duplicate error message in bdc_probe()
Date: Mon, 28 Sep 2020 12:40:35 +0300 [thread overview]
Message-ID: <87sgb29r3g.fsf@kernel.org> (raw)
In-Reply-To: <e895f44b-2c53-a883-322b-e3768fdb6733@cmss.chinamobile.com>
[-- Attachment #1: Type: text/plain, Size: 1754 bytes --]
Hi,
Tang Bin <tangbin@cmss.chinamobile.com> writes:
> Hi Greg KH:
>
> 在 2020/9/27 21:45, Greg KH 写道:
>> On Sun, Sep 27, 2020 at 09:42:18PM +0800, Tang Bin wrote:
>>> In this function, we don't need dev_err() message because
>>> when something goes wrong, devm_platform_ioremap_resource()
>>> can print an error message itself, so remove the redundant
>>> one.
>>>
>>> Signed-off-by: Zhang Shengju <zhangshengju@cmss.chinamobile.com>
>>> Signed-off-by: Tang Bin <tangbin@cmss.chinamobile.com>
>>> ---
>>> drivers/usb/gadget/udc/bdc/bdc_core.c | 4 +---
>>> 1 file changed, 1 insertion(+), 3 deletions(-)
>>>
>>> diff --git a/drivers/usb/gadget/udc/bdc/bdc_core.c b/drivers/usb/gadget/udc/bdc/bdc_core.c
>>> index 02a3a7746..9454f179e 100644
>>> --- a/drivers/usb/gadget/udc/bdc/bdc_core.c
>>> +++ b/drivers/usb/gadget/udc/bdc/bdc_core.c
>>> @@ -508,10 +508,8 @@ static int bdc_probe(struct platform_device *pdev)
>>> bdc->clk = clk;
>>>
>>> bdc->regs = devm_platform_ioremap_resource(pdev, 0);
>>> - if (IS_ERR(bdc->regs)) {
>>> - dev_err(dev, "ioremap error\n");
>>> + if (IS_ERR(bdc->regs))
>>> return -ENOMEM;
>> Why not return the error given to us?
>
> Because when get ioremap failed, devm_platform_ioremap_resource() can
> print error message
>
> "dev_err(dev, "ioremap failed for resource %pR\n", res)" in it's called
> function. So I think this's place's
>
> dev_err(dev, "ioremap error\n") is redundant.
that's not what Greg point you at, though. Greg's concern is valid in
that instead of passing along the error within bdc->regs, you always
return -ENOMEM. OTW, your code should read like so:
if (IS_ERR(bdc->regs))
return PTR_ERR(bdc->regs);
--
balbi
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 857 bytes --]
next prev parent reply other threads:[~2020-09-28 9:40 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-09-27 13:42 [PATCH] usb: bdc: Remove duplicate error message in bdc_probe() Tang Bin
2020-09-27 13:45 ` Greg KH
2020-09-28 8:45 ` Tang Bin
2020-09-28 9:40 ` Felipe Balbi [this message]
2020-09-28 10:55 ` Tang Bin
2020-09-28 11:23 ` Greg KH
2020-09-28 11:31 ` Tang Bin
2020-09-28 6:49 ` Chunfeng Yun
2020-09-28 8:40 ` Tang Bin
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=87sgb29r3g.fsf@kernel.org \
--to=balbi@kernel.org \
--cc=f.fainelli@gmail.com \
--cc=gregkh@linuxfoundation.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-usb@vger.kernel.org \
--cc=tangbin@cmss.chinamobile.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.