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: <201309041632.13150.marex@denx.de>
Date:	Wed, 4 Sep 2013 16:32:12 +0200
From:	Marek Vasut <marex@...x.de>
To:	Sachin Kamat <sachin.kamat@...aro.org>
Cc:	linux-kernel@...r.kernel.org, broonie@...nel.org, nm@...com,
	ldewangan@...dia.com, gg@...mlogic.co.uk, yong.shen@...aro.org,
	s.hauer@...gutronix.de, Nancy.Chen@...escale.com
Subject: Re: [PATCH 5/7] regulator: palmas: Use devm_regulator_register

Dear Sachin Kamat,

> devm_* simplifies the code.
> 
> Signed-off-by: Sachin Kamat <sachin.kamat@...aro.org>
> ---
>  drivers/regulator/palmas-regulator.c |   38
> ++++++++++------------------------ 1 file changed, 11 insertions(+), 27
> deletions(-)
> 
> diff --git a/drivers/regulator/palmas-regulator.c
> b/drivers/regulator/palmas-regulator.c index d0c8785..37b1068 100644
> --- a/drivers/regulator/palmas-regulator.c
> +++ b/drivers/regulator/palmas-regulator.c
> @@ -852,7 +852,7 @@ static int palmas_regulators_probe(struct
> platform_device *pdev) if (ret < 0) {
>  				dev_err(&pdev->dev,
>  					"reading TSTEP reg failed: %d\n", ret);
> -				goto err_unregister_regulator;
> +				return ret;
>  			}
>  			pmic->desc[id].ramp_delay =
>  					palmas_smps_ramp_delay[reg & 0x3];
> @@ -864,7 +864,7 @@ static int palmas_regulators_probe(struct
> platform_device *pdev) reg_init = pdata->reg_init[id];
>  			ret = palmas_smps_init(palmas, id, reg_init);
>  			if (ret)
> -				goto err_unregister_regulator;
> +				return ret;
>  		}
> 
>  		/* Register the regulators */
> @@ -897,7 +897,7 @@ static int palmas_regulators_probe(struct
> platform_device *pdev)
> 
>  			ret = palmas_smps_read(pmic->palmas, addr, &reg);
>  			if (ret)
> -				goto err_unregister_regulator;
> +				return ret;
>  			if (reg & PALMAS_SMPS12_VOLTAGE_RANGE)
>  				pmic->range[id] = 1;
> 
> @@ -913,7 +913,7 @@ static int palmas_regulators_probe(struct
> platform_device *pdev) addr = palmas_regs_info[id].ctrl_addr;
>  			ret = palmas_smps_read(pmic->palmas, addr, &reg);
>  			if (ret)
> -				goto err_unregister_regulator;
> +				return ret;
>  			pmic->current_reg_mode[id] = reg &
>  					PALMAS_SMPS12_CTRL_MODE_ACTIVE_MASK;
>  		}
> @@ -929,13 +929,13 @@ static int palmas_regulators_probe(struct
> platform_device *pdev) pmic->desc[id].supply_name =
> palmas_regs_info[id].sname;
>  		config.of_node = palmas_matches[id].of_node;
> 
> -		rdev = regulator_register(&pmic->desc[id], &config);
> +		rdev = devm_regulator_register(&pdev->dev, &pmic->desc[id],
> +					       &config);
>  		if (IS_ERR(rdev)) {
>  			dev_err(&pdev->dev,
>  				"failed to register %s regulator\n",
>  				pdev->name);
> -			ret = PTR_ERR(rdev);
> -			goto err_unregister_regulator;
> +			return PTR_ERR(rdev);
>  		}
> 
>  		/* Save regulator for cleanup */
> @@ -997,13 +997,13 @@ static int palmas_regulators_probe(struct
> platform_device *pdev) pmic->desc[id].supply_name =
> palmas_regs_info[id].sname;
>  		config.of_node = palmas_matches[id].of_node;
> 
> -		rdev = regulator_register(&pmic->desc[id], &config);
> +		rdev = devm_regulator_register(&pdev->dev, &pmic->desc[id],
> +					       &config);
>  		if (IS_ERR(rdev)) {
>  			dev_err(&pdev->dev,
>  				"failed to register %s regulator\n",
>  				pdev->name);
> -			ret = PTR_ERR(rdev);
> -			goto err_unregister_regulator;
> +			return PTR_ERR(rdev);
>  		}
> 
>  		/* Save regulator for cleanup */
> @@ -1021,7 +1021,7 @@ static int palmas_regulators_probe(struct
> platform_device *pdev) id, reg_init);
>  				if (ret) {
>  					regulator_unregister(pmic->rdev[id]);
> -					goto err_unregister_regulator;
> +					return ret;
>  				}

what about this regulator_unregister() above here?

[...]
Best regards,
Marek Vasut
--
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