power:pmic: prevent data abort for pmic bat command
PATCH 1/1 power:pmic: prevent data abort for pmic bat command
This patch prevents data abort when pmic bat command is called on non-batery pmic device.
Signed-off-by Piotr Wilczek <[email protected]>
Signed-off-by Kyungmin Park <[email protected]>
CC Lukasz Majewski <[email protected]>
CC Minkyu Kang <[email protected]>
--- drivers/power/power_core.c | 19 +++++++++++-------- 1 file changed, 11 insertions(+), 8 deletions(-)
drivers/power/power_core.c +11 -8
@@ -188,18 +188,21 @@ int do_pmic(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])if (argc <4 )return CMD_RET_USAGE ; +if (!p->pbat) { +printf ("%s is not a battery\n" , p->name); +return CMD_RET_FAILURE ; + } +if (strcmp (argv[3 ],"state" ) ==0 ) p->fg->fg_battery_check (p->pbat->fg, p);if (strcmp (argv[3 ],"charge" ) ==0 ) { -if (p->pbat) { -printf ("BAT: %s charging (ctrl+c to break)\n" , - p->name); -if (p->low_power_mode) - p->low_power_mode (); -if (p->pbat->battery_charge) - p->pbat->battery_charge (p); - } +printf ("BAT: %s charging (ctrl+c to break)\n" , + p->name); +if (p->low_power_mode) + p->low_power_mode (); +if (p->pbat->battery_charge) + p->pbat->battery_charge (p); }return CMD_RET_SUCCESS ;
Signature · 1 line
1.7.9.5
Quoted 7 lines · Piotr Wilczek
This patch prevents data abort when pmic bat command is called on non-batery pmic device.
Signed-off-by Piotr Wilczek <[email protected]>Signed-off-by Kyungmin Park <[email protected]>CC Lukasz Majewski <[email protected]>CC Minkyu Kang <[email protected]>
Applied to u-boot/master, thanks!
Signature · 8 lines
Tom -------------- next part -------------- A non-text attachment was scrubbed... Name: not available Type: application/pgp-signature Size: 836 bytes Desc: Digital signature URL: <http://lists.denx.de/pipermail/u-boot/attachments/20131007/12bfef97/attachment.pgp>