Re: [PATCH v2 1/4] regulator: act8865: set correct number of regulators in pdata
From: Axel Lin
Date: Sat Jul 05 2014 - 11:08:12 EST
2014-07-05 21:20 GMT+08:00 Beniamino Galvani <b.galvani@xxxxxxxxx>:
> act8865_pdata_from_dt() populates the array pdata->regulators with all
> the regulators and then assigns the field init_data only for the ones
> actually found in the DT.
>
> The patch changes the value assigned to pdata->num_regulators to match
> the size of the array.
>
> Signed-off-by: Beniamino Galvani <b.galvani@xxxxxxxxx>
> Tested-by: Wenyou Yang <wenyou.yang@xxxxxxxxx>
> ---
> drivers/regulator/act8865-regulator.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/regulator/act8865-regulator.c b/drivers/regulator/act8865-regulator.c
> index f07be36..52d1b6c 100644
> --- a/drivers/regulator/act8865-regulator.c
> +++ b/drivers/regulator/act8865-regulator.c
> @@ -230,7 +230,7 @@ static int act8865_pdata_from_dt(struct device *dev,
> if (!pdata->regulators)
> return -ENOMEM;
>
> - pdata->num_regulators = matched;
> + pdata->num_regulators = ARRAY_SIZE(act8865_matches);
> regulator = pdata->regulators;
You can also include below change as well:
diff --git a/drivers/regulator/act8865-regulator.c
b/drivers/regulator/act8865-regulator.c
index f07be36..9fcedc5 100644
--- a/drivers/regulator/act8865-regulator.c
+++ b/drivers/regulator/act8865-regulator.c
@@ -226,7 +226,7 @@ static int act8865_pdata_from_dt(struct device *dev,
pdata->regulators = devm_kzalloc(dev,
sizeof(struct act8865_regulator_data) *
- ARRAY_SIZE(act8865_matches), GFP_KERNEL);
+ matched, GFP_KERNEL);
if (!pdata->regulators)
return -ENOMEM;
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/