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]
Message-ID: <20200826191708.GA13466@kozik-lap>
Date:   Wed, 26 Aug 2020 21:17:08 +0200
From:   Krzysztof Kozlowski <krzk@...nel.org>
To:     Andy Shevchenko <andriy.shevchenko@...ux.intel.com>
Cc:     Dmitry Torokhov <dmitry.torokhov@...il.com>,
        Hans de Goede <hdegoede@...hat.com>,
        Linus Walleij <linus.walleij@...aro.org>,
        Bastien Nocera <hadess@...ess.net>,
        Sangwon Jee <jeesw@...fas.com>,
        Eugen Hristev <eugen.hristev@...rochip.com>,
        "Gustavo A. R. Silva" <gustavoars@...nel.org>,
        linux-input@...r.kernel.org, linux-kernel@...r.kernel.org,
        platform-driver-x86@...r.kernel.org
Subject: Re: [PATCH 01/24] Input: bcm-keypad - Simplify with dev_err_probe()

On Wed, Aug 26, 2020 at 10:12:17PM +0300, Andy Shevchenko wrote:
> On Wed, Aug 26, 2020 at 08:16:43PM +0200, Krzysztof Kozlowski wrote:
> > Common pattern of handling deferred probe can be simplified with
> > dev_err_probe().  Less code and also it prints the error value.
> 
> > +++ b/drivers/input/keyboard/bcm-keypad.c
> > @@ -379,11 +379,9 @@ static int bcm_kp_probe(struct platform_device *pdev)
> >  	kp->clk = devm_clk_get(&pdev->dev, "peri_clk");
> >  	if (IS_ERR(kp->clk)) {
> >  		error = PTR_ERR(kp->clk);
> > -		if (error != -ENOENT) {
> > -			if (error != -EPROBE_DEFER)
> > -				dev_err(&pdev->dev, "Failed to get clock\n");
> > -			return error;
> > -		}
> > +		if (error != -ENOENT)
> > +			return dev_err_probe(&pdev->dev, error, "Failed to get clock\n");
> > +
> >  		dev_dbg(&pdev->dev,
> >  			"No clock specified. Assuming it's enabled\n");
> 
> Shouldn't be this rather switch to devm_clk_get_optional() + dev_err_probe?

Indeed, it could be simplified even more. I'll send v2.

Best regards,
Krzysztof

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ