Skip to contentSkip to conversation

Bug in twl4030backupbatt_voltage()

DISCUSSION Adrian Hunter 3 participants 6 messages Sep 3, 2008 – Sep 11, 2008

lore
Share & tools
lore
#0 lore raw

In the omap tree, commit f91fd98be045bec9c18e13110f22dafd44cb84b5 fixed a bug with the use of function twl4030_madc_conversion() relating to the local variable 'struct twl4030_madc_request req' not being fully initialised.

The same problem appears to be in the function twl4030backupbatt_voltage() which is in drivers/power/twl4030_bci_battery.c

#1 lore raw
Quoted 7 lines · Adrian Hunter

In the omap tree, commit f91fd98be045bec9c18e13110f22dafd44cb84b5 fixed a bug with the use of function twl4030_madc_conversion() relating to the local variable 'struct twl4030_madc_request req' not being fully initialised.

The same problem appears to be in the function twl4030backupbatt_voltage() which is in drivers/power/twl4030_bci_battery.c

Thanks, I'll initialize it to NULL. Wouldn't it have been easier just to write a patch instead of the description above? :)

Tony

#2 lore raw
Quoted 11 lines · Tony Lindgren
Quoted 7 lines · Adrian Hunter

In the omap tree, commit f91fd98be045bec9c18e13110f22dafd44cb84b5 fixed a bug with the use of function twl4030_madc_conversion() relating to the local variable 'struct twl4030_madc_request req' not being fully initialised.

The same problem appears to be in the function twl4030backupbatt_voltage() which is in drivers/power/twl4030_bci_battery.c

Thanks, I'll initialize it to NULL. Wouldn't it have been easier just to write a patch instead of the description above? :)

Apparently.

There is also req.do_avg which should be zero, if you assume the programmer's intent was to have uninitialised members set to zero.

#3 lore raw

----- Original Message -----
From: "Adrian Hunter" <[email protected]>
To: "Tony Lindgren" <[email protected]>
Cc: <[email protected]>; <[email protected]>
Sent: Wednesday, September 10, 2008 12:58 PM
Subject: Re: Bug in twl4030backupbatt_voltage()

Quoted 10 lines
Quoted 9 lines · Tony Lindgren
Quoted 7 lines · Adrian Hunter

In the omap tree, commit f91fd98be045bec9c18e13110f22dafd44cb84b5 fixed a bug with the use of function twl4030_madc_conversion() relating to the local variable 'struct twl4030_madc_request req' not being fully initialised.

The same problem appears to be in the function twl4030backupbatt_voltage() which is in drivers/power/twl4030_bci_battery.c

Quoted 7 lines
Quoted 2 lines

Thanks, I'll initialize it to NULL. Wouldn't it have been easier just to write a patch instead of the description above? :)

Apparently.

There is also req.do_avg which should be zero, if you assume the programmer's intent was to have uninitialised members set to zero.

I guess, I did not look at all the other members of the "twl4030_madc_request" structure. I might have missed it. The do_avg and func_cb fields can both be set to NULL.

Regards,
Madhu

Quoted 2 lines
#4 lore raw
Quoted 22 lines · Madhusudhan Chikkature

----- Original Message -----
From: "Adrian Hunter" <[email protected]>
To: "Tony Lindgren" <[email protected]>
Cc: <[email protected]>; <[email protected]>
Sent: Wednesday, September 10, 2008 12:58 PM
Subject: Re: Bug in twl4030backupbatt_voltage()

Quoted 13 lines
Quoted 11 lines · Tony Lindgren
Quoted 7 lines · Adrian Hunter

In the omap tree, commit f91fd98be045bec9c18e13110f22dafd44cb84b5 fixed a bug with the use of function twl4030_madc_conversion() relating to the local variable 'struct twl4030_madc_request req' not being fully initialised.

The same problem appears to be in the function twl4030backupbatt_voltage() which is in drivers/power/twl4030_bci_battery.c

Thanks, I'll initialize it to NULL. Wouldn't it have been easier just to write a patch instead of the description above? :)

Quoted 6 lines
Quoted 4 lines

Apparently.

There is also req.do_avg which should be zero, if you assume the programmer's intent was to have uninitialised members set to zero.

I guess, I did not look at all the other members of the "twl4030_madc_request" structure. I might have missed it. The do_avg and func_cb fields can both be set to NULL.

Can you please check the code and send a patch?

Thanks,

Tony

#5 lore raw

----- Original Message -----
From: "Tony Lindgren" <[email protected]>
To: "Madhusudhan Chikkature" <[email protected]>
Cc: "Adrian Hunter" <[email protected]>; <[email protected]>
Sent: Wednesday, September 10, 2008 9:09 PM
Subject: Re: Bug in twl4030backupbatt_voltage()

Quoted 23 lines · Madhusudhan Chikkature
Quoted 22 lines

----- Original Message -----
From: "Adrian Hunter" <[email protected]>
To: "Tony Lindgren" <[email protected]>
Cc: <[email protected]>; <[email protected]>
Sent: Wednesday, September 10, 2008 12:58 PM
Subject: Re: Bug in twl4030backupbatt_voltage()

Quoted 13 lines
Quoted 11 lines · Tony Lindgren
Quoted 7 lines · Adrian Hunter

In the omap tree, commit f91fd98be045bec9c18e13110f22dafd44cb84b5 fixed a bug with the use of function twl4030_madc_conversion() relating to the local variable 'struct twl4030_madc_request req' not being fully initialised.

The same problem appears to be in the function twl4030backupbatt_voltage() which is in drivers/power/twl4030_bci_battery.c

Thanks, I'll initialize it to NULL. Wouldn't it have been easier just to write a patch instead of the description above? :)

Quoted 8 lines
Quoted 6 lines
Quoted 4 lines

Apparently.

There is also req.do_avg which should be zero, if you assume the programmer's intent was to have uninitialised members set to zero.

I guess, I did not look at all the other members of the "twl4030_madc_request" structure. I might have missed it. The do_avg and func_cb fields can both be set to NULL.

Can you please check the code and send a patch?

Yes. I will do that.

Regards,
Madhu

Quoted 6 lines

Thanks,

Tony