hc
2023-12-09 b22da3d8526a935aa31e086e63f60ff3246cb61c
kernel/drivers/power/supply/adp5061.c
....@@ -1,9 +1,8 @@
1
+// SPDX-License-Identifier: GPL-2.0-only
12 /*
23 * ADP5061 I2C Programmable Linear Battery Charger
34 *
45 * Copyright 2018 Analog Devices Inc.
5
- *
6
- * Licensed under the GPL-2.
76 */
87
98 #include <linux/init.h>
....@@ -428,11 +427,11 @@
428427 if (ret < 0)
429428 return ret;
430429
431
- chg_type = adp5061_chg_type[ADP5061_CHG_STATUS_1_CHG_STATUS(status1)];
432
- if (chg_type > ADP5061_CHG_FAST_CV)
430
+ chg_type = ADP5061_CHG_STATUS_1_CHG_STATUS(status1);
431
+ if (chg_type >= ARRAY_SIZE(adp5061_chg_type))
433432 val->intval = POWER_SUPPLY_STATUS_UNKNOWN;
434433 else
435
- val->intval = chg_type;
434
+ val->intval = adp5061_chg_type[chg_type];
436435
437436 return ret;
438437 }