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:	Sun, 26 Jan 2014 13:36:53 -0800
From:	Dmitry Torokhov <dmitry.torokhov@...il.com>
To:	Manish Badarkhe <badarkhe.manish@...il.com>
Cc:	linux-omap@...r.kernel.org, linux-samsung-soc@...r.kernel.org,
	linux-tegra@...r.kernel.org, linux-kernel@...r.kernel.org,
	broonie@...nel.org, lgirdwood@...il.com
Subject: Re: [PATCH] regulator: fixed: Use devm_regulator_register

Hi Manish,

On Sat, Jan 25, 2014 at 11:35:54PM +0530, Manish Badarkhe wrote:
> Use "devm_regulator_register" instead of "regulator_register"
> which simplifies the code.

... and also breaks the driver: now you are freeing desc->name and
desc->supply_name while regulator structures are still alive and can be
referenced from its sysfs attributes, etc.

> 
> Signed-off-by: Manish Badarkhe <badarkhe.manish@...il.com>
> ---
> :100644 100644 5ea64b9... 6d32341... M	drivers/regulator/fixed.c
>  drivers/regulator/fixed.c |    4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/regulator/fixed.c b/drivers/regulator/fixed.c
> index 5ea64b9..6d32341 100644
> --- a/drivers/regulator/fixed.c
> +++ b/drivers/regulator/fixed.c
> @@ -186,7 +186,8 @@ static int reg_fixed_voltage_probe(struct platform_device *pdev)
>  	cfg.driver_data = drvdata;
>  	cfg.of_node = pdev->dev.of_node;
>  
> -	drvdata->dev = regulator_register(&drvdata->desc, &cfg);
> +	drvdata->dev = devm_regulator_register(&pdev->dev, &drvdata->desc,
> +					       &cfg);
>  	if (IS_ERR(drvdata->dev)) {
>  		ret = PTR_ERR(drvdata->dev);
>  		dev_err(&pdev->dev, "Failed to register regulator: %d\n", ret);
> @@ -212,7 +213,6 @@ static int reg_fixed_voltage_remove(struct platform_device *pdev)
>  {
>  	struct fixed_voltage_data *drvdata = platform_get_drvdata(pdev);
>  
> -	regulator_unregister(drvdata->dev);
>  	kfree(drvdata->desc.supply_name);
>  	kfree(drvdata->desc.name);
>  

Thanks.

-- 
Dmitry
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ