eeprom_93cx6: do not assume zeroed buffer
From: Michael Wu <[email protected]>
eeprom_93cx6_read_bits assumes u16 *data is already zeroed. This removes
that assumption.
Thanks to Andrea Merello <[email protected]> for discovering this issue.
Signed-off-by: Michael Wu <[email protected]>
---
drivers/misc/eeprom_93cx6.c | 5 ++++-
1 files changed, 4 insertions(+), 1 deletions(-)
diff --git a/drivers/misc/eeprom_93cx6.c b/drivers/misc/eeprom_93cx6.c
index e5d016b..a948ddc 100644
--- a/drivers/misc/eeprom_93cx6.c
+++ b/drivers/misc/eeprom_93cx6.c
@@ -127,6 +127,7 @@ static void eeprom_93cx6_read_bits(struct eeprom_93cx6
*eeprom,
u16 *data, const u16 count)
{
unsigned int i;
+ u16 buf = 0;
eeprom->register_read(eeprom);
@@ -153,10 +154,12 @@ static void eeprom_93cx6_read_bits(struct eeprom_93cx6
*eeprom,
* Read if the bit has been set.
*/
if (eeprom->reg_data_out)
- *data |= (1 << (i - 1));
+ buf |= (1 << (i - 1));
eeprom_93cx6_pulse_low(eeprom);
}
+
+ *data = buf;
}
static void eeprom_93cx6_ewen(struct eeprom_93cx6 *eeprom)
On Friday 13 April 2007 16:17, Michael Wu wrote:
> eeprom_93cx6: do not assume zeroed buffer
>
> From: Michael Wu <[email protected]>
>
> eeprom_93cx6_read_bits assumes u16 *data is already zeroed. This removes
> that assumption.
ACK. :)
This was indeed an issue where I was doubting if the driver should make sure the data
was set to zero or that the calling driver should be responsible.
Ivo