.. | .. |
---|
| 1 | +// SPDX-License-Identifier: GPL-2.0-or-later |
---|
1 | 2 | /* |
---|
2 | 3 | * TWL4030/TPS65950 BCI (Battery Charger Interface) driver |
---|
3 | 4 | * |
---|
.. | .. |
---|
5 | 6 | * |
---|
6 | 7 | * based on twl4030_bci_battery.c by TI |
---|
7 | 8 | * 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. |
---|
13 | 9 | */ |
---|
14 | 10 | |
---|
15 | 11 | #include <linux/init.h> |
---|
.. | .. |
---|
730 | 726 | |
---|
731 | 727 | for (i = 0; i < ARRAY_SIZE(modes); i++) |
---|
732 | 728 | if (mode == i) |
---|
733 | | - len += snprintf(buf+len, PAGE_SIZE-len, |
---|
| 729 | + len += scnprintf(buf+len, PAGE_SIZE-len, |
---|
734 | 730 | "[%s] ", modes[i]); |
---|
735 | 731 | else |
---|
736 | | - len += snprintf(buf+len, PAGE_SIZE-len, |
---|
| 732 | + len += scnprintf(buf+len, PAGE_SIZE-len, |
---|
737 | 733 | "%s ", modes[i]); |
---|
738 | 734 | buf[len-1] = '\n'; |
---|
739 | 735 | return len; |
---|
.. | .. |
---|
809 | 805 | is_charging = state & TWL4030_MSTATEC_AC; |
---|
810 | 806 | if (!is_charging) { |
---|
811 | 807 | u8 s; |
---|
812 | | - twl4030_bci_read(TWL4030_BCIMDEN, &s); |
---|
| 808 | + ret = twl4030_bci_read(TWL4030_BCIMDEN, &s); |
---|
| 809 | + if (ret < 0) |
---|
| 810 | + return ret; |
---|
813 | 811 | if (psy->desc->type == POWER_SUPPLY_TYPE_USB) |
---|
814 | 812 | is_charging = s & 1; |
---|
815 | 813 | else |
---|