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: <20170120101054.GB3824@ulmo.ba.sec>
Date:   Fri, 20 Jan 2017 11:10:54 +0100
From:   Thierry Reding <thierry.reding@...il.com>
To:     Dmitry Torokhov <dmitry.torokhov@...il.com>
Cc:     linux-input@...r.kernel.org, linux-kernel@...r.kernel.org,
        David Lechner <david@...hnology.com>,
        Frieder Schrempf <frieder.schrempf@...eet.de>
Subject: Re: [PATCH v2 2/7] Input: pwm-beeper - switch to using managed
 resources

On Thu, Jan 19, 2017 at 02:40:52PM -0800, Dmitry Torokhov wrote:
> Use of managed resources (devm) simplifies error handling and tear down
> of the driver.
> 
> Signed-off-by: Dmitry Torokhov <dmitry.torokhov@...il.com>
> ---
>  drivers/input/misc/pwm-beeper.c | 44 ++++++++++-------------------------------
>  1 file changed, 10 insertions(+), 34 deletions(-)
> 
> diff --git a/drivers/input/misc/pwm-beeper.c b/drivers/input/misc/pwm-beeper.c
> index cb87e475bd23..14c52054f5b7 100644
> --- a/drivers/input/misc/pwm-beeper.c
> +++ b/drivers/input/misc/pwm-beeper.c
> @@ -95,18 +95,19 @@ static void pwm_beeper_close(struct input_dev *input)
>  
>  static int pwm_beeper_probe(struct platform_device *pdev)
>  {
> +	struct device *dev = &pdev->dev;
>  	struct pwm_beeper *beeper;
>  	int error;
>  
> -	beeper = kzalloc(sizeof(*beeper), GFP_KERNEL);
> +	beeper = devm_kzalloc(dev, sizeof(*beeper), GFP_KERNEL);
>  	if (!beeper)
>  		return -ENOMEM;
>  
> -	beeper->pwm = pwm_get(&pdev->dev, NULL);
> +	beeper->pwm = devm_pwm_get(dev, NULL);
>  	if (IS_ERR(beeper->pwm)) {
>  		error = PTR_ERR(beeper->pwm);
> -		dev_err(&pdev->dev, "Failed to request pwm device: %d\n", error);
> -		goto err_free;
> +		dev_err(dev, "Failed to request pwm device: %d\n", error);

While at it, could you do a "pwm" -> "PWM" in the above. It's an
abbreviation.

Otherwise this looks like great cleanup:

Reviewed-by: Thierry Reding <thierry.reding@...il.com>

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

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ