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.
---
It was sent on https://lkml.org/lkml/2011/7/5/559
and resent on https://lkml.org/lkml/2011/8/31/122.
Seems this patch is lost so I resend it again.
Axel
drivers/regulator/aat2870-regulator.c | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-)
drivers/regulator/aat2870-regulator.c +1 -1
@@ -160,7 +160,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.5.4
PATCH 2/2 regulator: aat2870: Remove a redundant bitwise and operation
The implementation in aat2870_update() already did the bitwise and operation against mask parameter.
---
It was sent on https://lkml.org/lkml/2011/7/5/560
and resent on https://lkml.org/lkml/2011/8/29/210.
Seems the patch is lost so I resend it again.
Axel
drivers/regulator/aat2870-regulator.c | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-)
drivers/regulator/aat2870-regulator.c +1 -1
@@ -63,7 +63,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.5.4
Mark Brown
AppliedRe: [PATCH 2/2] regulator: aat2870: Remove a redundant bitwise and operation
Quoted 2 lines · Axel Lin
The implementation in
aat2870_update()already did the bitwise and operation against mask parameter.
Applied, thanks.
Mark Brown
AppliedQuoted 2 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.
Applied, thanks.