Skip to contentSkip to conversation

rtc: palmas: Initialise bb_charging flag before using it

PATCH In review Laxman Dewangan 2 participants 2 messages May 29, 2015 – Jun 8, 2015 Real time clock (RTC)

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 rtc: palmas: Initialise bb_charging flag before using it

Initialise the variable high_bb_charging before using it to avoid configuring wrong value and fix following compilation warning:

/*
rtc-palmas.c: In function =E2=80=98palmas_rtc_probe=E2=80=99:
rtc-palmas.c:242:7: warning: =E2=80=98high_bb_charging=E2=80=99 may be used uninitialized in this function
*/

---
 drivers/rtc/rtc-palmas.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/rtc/rtc-palmas.c +0 -0
index 3b01d56..7ea2c47 100644
@@ -239,7 +239,7 @@ static int palmas_rtc_probe(struct platform_device *pde=

v)
struct palmas_rtc *palmas_rtc =3D NULL;
int ret;
bool enable_bb_charging =3D false;
- bool high_bb_charging;
+ bool high_bb_charging =3D false;
=20
if (pdev->dev.of_node) {
enable_bb_charging =3D of_property_read_bool(pdev->dev.of_node,
--=20
2.1.4

--=20
--=20
You received this message because you are subscribed to "rtc-linux". Membership options at http://groups.google.com/group/rtc-linux . Please read http://groups.google.com/group/rtc-linux/web/checklist
before submitting a driver.
---=20
You received this message because you are subscribed to the Google Groups "= rtc-linux" group.
To unsubscribe from this group and stop receiving emails from it, send an e= mail to [email protected].
For more options, visit https://groups.google.com/d/optout.

#1 lore raw
Quoted 9 lines · Laxman Dewangan

Initialise the variable high_bb_charging before using it to avoid configuring wrong value and fix following compilation warning:

/*
rtc-palmas.c: In function ‘palmas_rtc_probe’:
rtc-palmas.c:242:7: warning: ‘high_bb_charging’ may be used uninitialized in this function
*/

I didn't find a way to get that warning and I'm interested to know how you got it.

I've applied the patch anyway.

Quoted 1 line
Signature · 3 lines
Alexandre Belloni, Free Electrons
Embedded Linux, Kernel and Android engineering
http://free-electrons.com