Skip to contentSkip to conversation

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

PATCH RESEND Superseded Axel Lin 2 participants 7 messages Jul 6, 2011 – Aug 10, 2011 Voltage and current regulator framework

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.

---
 drivers/regulator/aat2870-regulator.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
drivers/regulator/aat2870-regulator.c +1 -1
index cd41045..11d1ab4 100644
@@ -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
author
#1 lore raw

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.

---
 drivers/regulator/aat2870-regulator.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
drivers/regulator/aat2870-regulator.c +1 -1
index 11d1ab4..c8ea28e 100644
@@ -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
author
#2 lore raw
In reply to Axel Lin

hi,
Seems this 2 patches are not upstream. Should I resend it again? Regards,
Axel

2011/7/7 Axel Lin <[email protected]>:

Quoted 28 lines

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.

---
 drivers/regulator/aat2870-regulator.c |    2 +-

 1 files changed, 1 insertions(+), 1 deletions(-)
drivers/regulator/aat2870-regulator.c +1 -2
index cd41045..11d1ab4 100644
@@ -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;
--

1.7.4.1

#3 lore raw
Quoted 4 lines · Axel Lin

hi,
Seems this 2 patches are not upstream. Should I resend it again? Regards,
Axel

Not required atm thanks, this driver went via mfd so I can apply the fix after the mfd merge or rc1.

Liam

Quoted 30 lines

2011/7/7 Axel Lin <[email protected]>:

Quoted 28 lines

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.

---
 drivers/regulator/aat2870-regulator.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
drivers/regulator/aat2870-regulator.c +1 -2
index cd41045..11d1ab4 100644
@@ -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;
--

1.7.4.1

author
#4 lore raw

2011/7/30 Liam Girdwood <[email protected]>:

Quoted 8 lines · Axel Lin
Quoted 4 lines

hi,
Seems this 2 patches are not upstream. Should I resend it again? Regards,
Axel

Not required atm thanks, this driver went via mfd so I can apply the fix after the mfd merge or rc1.

hi Liam,
aat2870-regulator.c is already merged to your tree but seems these 2 patches are not (yet) upstream.

Regards,
Axel

#5 lore raw
Quoted 7 lines · Axel Lin

2011/7/30 Liam Girdwood <[email protected]>:

Quoted 6 lines · Axel Lin
Quoted 4 lines

hi,
Seems this 2 patches are not upstream. Should I resend it again? Regards,
Axel

Quoted 6 lines
Quoted 2 lines

Not required atm thanks, this driver went via mfd so I can apply the fix after the mfd merge or rc1.

hi Liam,
aat2870-regulator.c is already merged to your tree but seems these 2 patches are not (yet) upstream.

Could you check regulator git #for-linus. I applied a bunch of patches a few days ago and some for this device. I'll do a pull request for rc2 in a few days.

Thanks

Liam

author
#6 lore raw
Quoted 1 line

Could you check regulator git #for-linus. I applied a bunch of patches a few days ago and some for this device. I'll do a pull request for rc2 in a few days.

Just checked both #for-linus and #for-next, I'm sure these 2 patches are missing.

below is the commit history for aat2870-regulator.c:
#for-linus
http://git.kernel.org/?p=linux/kernel/git/lrg/voltage-2.6.git;a=history;f=drivers/regulator/aat2870-regulator.c;h=5abeb3ac3e8da43df3d58bf677c3ac0e3d17116e;hb=9d92d3fc20b2095b75d66824e5cc34a9e088dea0

#for-next
http://git.kernel.org/?p=linux/kernel/git/lrg/voltage-2.6.git;a=history;f=drivers/regulator/aat2870-regulator.c;h=5abeb3ac3e8da43df3d58bf677c3ac0e3d17116e;hb=fc999b83799074832367d3cfd724c341c849a7da

Regards,
Axel