From: Dan Carpenter <dan.carpenter@oracle.com>
To: macromorgan@hotmail.com
Cc: linux-pm@vger.kernel.org
Subject: [bug report] power: supply: Add charger driver for Rockchip RK817
Date: Mon, 10 Oct 2022 16:14:38 +0300 [thread overview]
Message-ID: <Y0QavmQuuCUUf+CK@kili> (raw)
Hello Chris Morgan,
The patch 11cb8da0189b: "power: supply: Add charger driver for
Rockchip RK817" from Aug 26, 2022, leads to the following Smatch
static checker warning:
drivers/power/supply/rk817_charger.c:143 rk817_chg_cur_to_reg()
warn: signedness bug returning '(-22)'
drivers/power/supply/rk817_charger.c
124 static u8 rk817_chg_cur_to_reg(u32 chg_cur_ma)
^^
This is a u8.
125 {
126 if (chg_cur_ma >= 3500)
127 return CHG_3_5A;
128 else if (chg_cur_ma >= 3000)
129 return CHG_3A;
130 else if (chg_cur_ma >= 2750)
131 return CHG_2_75A;
132 else if (chg_cur_ma >= 2500)
133 return CHG_2_5A;
134 else if (chg_cur_ma >= 2000)
135 return CHG_2A;
136 else if (chg_cur_ma >= 1500)
137 return CHG_1_5A;
138 else if (chg_cur_ma >= 1000)
139 return CHG_1A;
140 else if (chg_cur_ma >= 500)
141 return CHG_0_5A;
142 else
--> 143 return -EINVAL;
^^^^^^^^^^^^^^^
Can't return a negative.
144 }
regards,
dan carpenter
next reply other threads:[~2022-10-10 13:15 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-10-10 13:14 Dan Carpenter [this message]
-- strict thread matches above, loose matches on Subject: below --
2023-05-04 10:58 [bug report] power: supply: Add charger driver for Rockchip RK817 Dan Carpenter
2023-05-08 18:46 ` Chris Morgan
2023-05-09 4:19 ` Dan Carpenter
2023-05-15 16:49 ` Chris Morgan
2023-05-17 10:52 ` Dan Carpenter
2023-05-17 17:17 ` Chris Morgan
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=Y0QavmQuuCUUf+CK@kili \
--to=dan.carpenter@oracle.com \
--cc=linux-pm@vger.kernel.org \
--cc=macromorgan@hotmail.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.