Skip to contentSkip to conversation

regulator: aat2870: Fix the logic of checking if no id is matched in aat2870_get_regulator

PATCH RESEND Applied Axel Lin 2 participants 4 messages Nov 28, 2011 Voltage and current regulator framework

v1 of 2 Applied Latest is v2 →

lore
Share & tools
lore

Axel Lin

author
#0 lore raw

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
index 07e98ec..43b25cc 100644
@@ -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
author
#1 lore raw

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
index 43b25cc..685ad43 100644
@@ -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
Applied
#2 lore raw

Re: [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.

Applied
#3 lore raw
In reply to Axel Lin
Quoted 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.