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: <20150326083209.GE5951@x1>
Date:	Thu, 26 Mar 2015 08:32:09 +0000
From:	Lee Jones <lee.jones@...aro.org>
To:	Johan Hovold <johan@...nel.org>
Cc:	Support Opensource <support.opensource@...semi.com>,
	Samuel Ortiz <sameo@...ux.intel.com>,
	Liam Girdwood <lgirdwood@...il.com>,
	Mark Brown <broonie@...nel.org>, linux-kernel@...r.kernel.org,
	Bartlomiej Zolnierkiewicz <b.zolnierkie@...sung.com>,
	Milo Kim <milo.kim@...com>,
	patches@...nsource.wolfsonmicro.com,
	Fabio Estevam <fabio.estevam@...escale.com>,
	Marek Szyprowski <m.szyprowski@...sung.com>,
	stable <stable@...r.kernel.org>
Subject: Re: [PATCH 1/2] mfd: da9052: fix broken regulator probe

On Wed, 25 Mar 2015, Johan Hovold wrote:

> Fix broken probe of da9052 regulators, which since commit b3f6c73db732
> ("mfd: da9052-core: Fix platform-device id collision") use a
> non-deterministic platform-device id to retrieve static regulator
> information. Fortunately, adequate error handling was in place so probe
> would simply fail with an error message.
> 
> Update the mfd-cell ids to be zero-based and use those to identify the
> cells when probing the regulator devices.
> 
> Fixes: b3f6c73db732 ("mfd: da9052-core: Fix platform-device id collision")
> Cc: stable <stable@...r.kernel.org>	# v3.19
> Signed-off-by: Johan Hovold <johan@...nel.org>
> ---
>  drivers/mfd/da9052-core.c            | 8 ++++----
>  drivers/regulator/da9052-regulator.c | 5 +++--

Need an Ack from Mark, but looks good to me.

Acked-by: Lee Jones <lee.jones@...aro.org>

>  2 files changed, 7 insertions(+), 6 deletions(-)
> 
> diff --git a/drivers/mfd/da9052-core.c b/drivers/mfd/da9052-core.c
> index ae498b53ee40..46e3840c7a37 100644
> --- a/drivers/mfd/da9052-core.c
> +++ b/drivers/mfd/da9052-core.c
> @@ -433,6 +433,10 @@ EXPORT_SYMBOL_GPL(da9052_adc_read_temp);
>  static const struct mfd_cell da9052_subdev_info[] = {
>  	{
>  		.name = "da9052-regulator",
> +		.id = 0,
> +	},
> +	{
> +		.name = "da9052-regulator",
>  		.id = 1,
>  	},
>  	{
> @@ -484,10 +488,6 @@ static const struct mfd_cell da9052_subdev_info[] = {
>  		.id = 13,
>  	},
>  	{
> -		.name = "da9052-regulator",
> -		.id = 14,
> -	},
> -	{
>  		.name = "da9052-onkey",
>  	},
>  	{
> diff --git a/drivers/regulator/da9052-regulator.c b/drivers/regulator/da9052-regulator.c
> index 8a4df7a1f2ee..e628d4c2f2ae 100644
> --- a/drivers/regulator/da9052-regulator.c
> +++ b/drivers/regulator/da9052-regulator.c
> @@ -394,6 +394,7 @@ static inline struct da9052_regulator_info *find_regulator_info(u8 chip_id,
>  
>  static int da9052_regulator_probe(struct platform_device *pdev)
>  {
> +	const struct mfd_cell *cell = mfd_get_cell(pdev);
>  	struct regulator_config config = { };
>  	struct da9052_regulator *regulator;
>  	struct da9052 *da9052;
> @@ -409,7 +410,7 @@ static int da9052_regulator_probe(struct platform_device *pdev)
>  	regulator->da9052 = da9052;
>  
>  	regulator->info = find_regulator_info(regulator->da9052->chip_id,
> -					      pdev->id);
> +					      cell->id);
>  	if (regulator->info == NULL) {
>  		dev_err(&pdev->dev, "invalid regulator ID specified\n");
>  		return -EINVAL;
> @@ -419,7 +420,7 @@ static int da9052_regulator_probe(struct platform_device *pdev)
>  	config.driver_data = regulator;
>  	config.regmap = da9052->regmap;
>  	if (pdata && pdata->regulators) {
> -		config.init_data = pdata->regulators[pdev->id];
> +		config.init_data = pdata->regulators[cell->id];
>  	} else {
>  #ifdef CONFIG_OF
>  		struct device_node *nproot = da9052->dev->of_node;

-- 
Lee Jones
Linaro STMicroelectronics Landing Team Lead
Linaro.org │ Open source software for ARM SoCs
Follow Linaro: Facebook | Twitter | Blog
--
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