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>] [day] [month] [year] [list]
Message-ID: <79e46f2f-c3ed-d187-2553-e64e0aac4c13@canonical.com>
Date:   Wed, 1 Sep 2021 10:56:14 +0200
From:   Krzysztof Kozlowski <krzysztof.kozlowski@...onical.com>
To:     zhaoxiao <zhaoxiao@...ontech.com>, thierry.reding@...il.com,
        lee.jones@...aro.org
Cc:     u.kleine-koenig@...gutronix.de,
        linux-arm-kernel@...ts.infradead.org,
        linux-samsung-soc@...r.kernel.org, linux-pwm@...r.kernel.org,
        linux-kernel@...r.kernel.org
Subject: Re: [PATCH] pwm: samsung: Simplify using devm_pwmchip_add()

On 01/09/2021 07:42, zhaoxiao wrote:
> With devm_pwmchip_add() we can drop pwmchip_remove() from the device
> remove callback. The latter can then go away, too and as this is the
> only user of platform_get_drvdata(), the respective call to
> platform_set_drvdata() can go, too.
> 
> Signed-off-by: zhaoxiao <zhaoxiao@...ontech.com>
> ---
>  drivers/pwm/pwm-samsung.c | 18 +-----------------
>  1 file changed, 1 insertion(+), 17 deletions(-)
> 
> diff --git a/drivers/pwm/pwm-samsung.c b/drivers/pwm/pwm-samsung.c
> index f6c528f02d43..b860a7b8bbdf 100644
> --- a/drivers/pwm/pwm-samsung.c
> +++ b/drivers/pwm/pwm-samsung.c
> @@ -560,9 +560,7 @@ static int pwm_samsung_probe(struct platform_device *pdev)
>  	chip->tclk0 = devm_clk_get(&pdev->dev, "pwm-tclk0");
>  	chip->tclk1 = devm_clk_get(&pdev->dev, "pwm-tclk1");
>  
> -	platform_set_drvdata(pdev, chip);

The test looks untested because this should cause bug during resume.
> -
> -	ret = pwmchip_add(&chip->chip);
> +	ret = devm_pwmchip_add(&pdev->dev, &chip->chip);
>  	if (ret < 0) {
>  		dev_err(dev, "failed to register PWM chip\n");
>  		clk_disable_unprepare(chip->base_clk);
> @@ -577,19 +575,6 @@ static int pwm_samsung_probe(struct platform_device *pdev)
>  	return 0;
>  }
>  
> -static int pwm_samsung_remove(struct platform_device *pdev)
> -{
> -	struct samsung_pwm_chip *chip = platform_get_drvdata(pdev);
> -	int ret;
> -
> -	ret = pwmchip_remove(&chip->chip);
> -	if (ret < 0)
> -		return ret;
> -
> -	clk_disable_unprepare(chip->base_clk);

NAK, the patch looks bad. You cannot remove some code from remove()
callback just "because".


Best regards,
Krzysztof

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ