Linux-ARM-Kernel Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: jhbird.choi@gmail.com (jhbird.choi at gmail.com)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH] max8997_charger: Fix unsigned value for less than zero
Date: Sat, 29 Oct 2011 07:56:32 +0900	[thread overview]
Message-ID: <1319842592-11334-1-git-send-email-jhbird.choi@gmail.com> (raw)

From: Jonghwan Choi <jhbird.choi@gmail.com>

The 'val' is a 'unsigned char', so it is never less than zero.

Signed-off-by: Jonghwan Choi <jhbird.choi@gmail.com>
---
 drivers/power/max8997_charger.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/drivers/power/max8997_charger.c b/drivers/power/max8997_charger.c
index ffc5033..a5eb3ed 100644
--- a/drivers/power/max8997_charger.c
+++ b/drivers/power/max8997_charger.c
@@ -97,7 +97,7 @@ static __devinit int max8997_battery_probe(struct platform_device *pdev)
 		return -EINVAL;
 
 	if (pdata->eoc_mA) {
-		u8 val = (pdata->eoc_mA - 50) / 10;
+		int val = (pdata->eoc_mA - 50) / 10;
 		if (val < 0)
 			val = 0;
 		if (val > 0xf)
-- 
1.7.0.4

                 reply	other threads:[~2011-10-28 22:56 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

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=1319842592-11334-1-git-send-email-jhbird.choi@gmail.com \
    --to=jhbird.choi@gmail.com \
    --cc=linux-arm-kernel@lists.infradead.org \
    /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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox