regulator: aat2870: Fix the logic of checking if no id is matched in aat2870_get_regulator
PATCH RESEND 1/2 regulator: aat2870: Fix the logic of checking if no id is matched in aat2870_get_regulator
In current implementation, the pointer ri is not NULL if no id is matched. Fix it by checking i == ARRAY_SIZE(aat2870_regulators) if no id is matched.
Signed-off-by Axel Lin <[email protected]>
Acked-by Mark Brown <[email protected]>
--- drivers/regulator/aat2870-regulator.c | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-)
drivers/regulator/aat2870-regulator.c +1 -1
@@ -159,7 +159,7 @@ static struct aat2870_regulator *aat2870_get_regulator(int id)break ; } -if (!ri) +if (i ==ARRAY_SIZE (aat2870_regulators))return NULL ; ri->enable_addr =AAT2870_LDO_EN ;
Signature · 1 line
1.7.4.1
PATCH RESEND 2/2 regulator: aat2870: Remove a redundant bitwise and operation
The implementation in aat2870_update() already did the bitwise and operation against mask parameter.
Signed-off-by Axel Lin <[email protected]>
Acked-by Mark Brown <[email protected]>
--- drivers/regulator/aat2870-regulator.c | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-)
drivers/regulator/aat2870-regulator.c +1 -1
@@ -62,7 +62,7 @@ static int aat2870_ldo_set_voltage_sel(struct regulator_dev *rdev,struct aat2870_data *aat2870 =dev_get_drvdata (ri->pdev->dev.parent);return aat2870->update (aat2870, ri->voltage_addr, ri->voltage_mask, - (selector << ri->voltage_shift) & ri->voltage_mask); + selector << ri->voltage_shift); }static int aat2870_ldo_get_voltage_sel (struct regulator_dev *rdev)
Signature · 1 line
1.7.4.1
Quoted 14 lines · Axel Lin
In current implementation, the pointer ri is not NULL if no id is matched. Fix it by checking i ==
ARRAY_SIZE(aat2870_regulators)if no id is matched.Signed-off-by Axel Lin <[email protected]>Acked-by Mark Brown <[email protected]>--- drivers/regulator/aat2870-regulator.c | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-)drivers/regulator/aat2870-regulator.c +0
-0
drivers/regulator/aat2870-regulator.c static struct aat2870_regulator *aat2870_get_regulator(int id) · line 165
Quoted 8 lines
drivers/regulator/aat2870-regulator.c +1
-1@@ -159,7 +159,7 @@ static struct aat2870_regulator *aat2870_get_regulator(int id)break ; } -if (!ri) +if (i ==ARRAY_SIZE (aat2870_regulators))return NULL ; ri->enable_addr =AAT2870_LDO_EN ;
Both applied.
Thanks
Liam