lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date:   Mon, 28 Sep 2020 12:40:35 +0300
From:   Felipe Balbi <balbi@...nel.org>
To:     Tang Bin <tangbin@...s.chinamobile.com>,
        Greg KH <gregkh@...uxfoundation.org>
Cc:     linux-usb@...r.kernel.org, linux-kernel@...r.kernel.org,
        Florian Fainelli <f.fainelli@...il.com>
Subject: Re: [PATCH] usb: bdc: Remove duplicate error message in bdc_probe()


Hi,

Tang Bin <tangbin@...s.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@...s.chinamobile.com>
>>> Signed-off-by: Tang Bin <tangbin@...s.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

Download attachment "signature.asc" of type "application/pgp-signature" (858 bytes)

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ