hc
2023-12-09 b22da3d8526a935aa31e086e63f60ff3246cb61c
kernel/drivers/power/supply/twl4030_charger.c
....@@ -1,3 +1,4 @@
1
+// SPDX-License-Identifier: GPL-2.0-or-later
12 /*
23 * TWL4030/TPS65950 BCI (Battery Charger Interface) driver
34 *
....@@ -5,11 +6,6 @@
56 *
67 * based on twl4030_bci_battery.c by TI
78 * Copyright (C) 2008 Texas Instruments, Inc.
8
- *
9
- * This program is free software; you can redistribute it and/or modify
10
- * it under the terms of the GNU General Public License as published by
11
- * the Free Software Foundation; either version 2 of the License, or
12
- * (at your option) any later version.
139 */
1410
1511 #include <linux/init.h>
....@@ -730,10 +726,10 @@
730726
731727 for (i = 0; i < ARRAY_SIZE(modes); i++)
732728 if (mode == i)
733
- len += snprintf(buf+len, PAGE_SIZE-len,
729
+ len += scnprintf(buf+len, PAGE_SIZE-len,
734730 "[%s] ", modes[i]);
735731 else
736
- len += snprintf(buf+len, PAGE_SIZE-len,
732
+ len += scnprintf(buf+len, PAGE_SIZE-len,
737733 "%s ", modes[i]);
738734 buf[len-1] = '\n';
739735 return len;
....@@ -809,7 +805,9 @@
809805 is_charging = state & TWL4030_MSTATEC_AC;
810806 if (!is_charging) {
811807 u8 s;
812
- twl4030_bci_read(TWL4030_BCIMDEN, &s);
808
+ ret = twl4030_bci_read(TWL4030_BCIMDEN, &s);
809
+ if (ret < 0)
810
+ return ret;
813811 if (psy->desc->type == POWER_SUPPLY_TYPE_USB)
814812 is_charging = s & 1;
815813 else