Skip to content

Commit

Permalink
Input: sentelic - silence some underflow warnings
Browse files Browse the repository at this point in the history
I have a static checker that complains when we check for an upper bound
but don't have a corresponding check for a lower bound.  With this code,
the upper bound check seems not really required, so it is not a bug to
leave the lower bound check out as well.  But let's silence the warning
by making these variables unsigned.

Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
  • Loading branch information
Dan Carpenter authored and Dmitry Torokhov committed Aug 21, 2015
1 parent 012bd2a commit 9c8f557
Showing 1 changed file with 8 additions and 6 deletions.
14 changes: 8 additions & 6 deletions drivers/input/mouse/sentelic.c
Original file line number Diff line number Diff line change
Expand Up @@ -432,15 +432,15 @@ static int fsp_onpad_hscr(struct psmouse *psmouse, bool enable)
static ssize_t fsp_attr_set_setreg(struct psmouse *psmouse, void *data,
const char *buf, size_t count)
{
int reg, val;
unsigned int reg, val;
char *rest;
ssize_t retval;

reg = simple_strtoul(buf, &rest, 16);
if (rest == buf || *rest != ' ' || reg > 0xff)
return -EINVAL;

retval = kstrtoint(rest + 1, 16, &val);
retval = kstrtouint(rest + 1, 16, &val);
if (retval)
return retval;

Expand Down Expand Up @@ -476,9 +476,10 @@ static ssize_t fsp_attr_set_getreg(struct psmouse *psmouse, void *data,
const char *buf, size_t count)
{
struct fsp_data *pad = psmouse->private;
int reg, val, err;
unsigned int reg, val;
int err;

err = kstrtoint(buf, 16, &reg);
err = kstrtouint(buf, 16, &reg);
if (err)
return err;

Expand Down Expand Up @@ -511,9 +512,10 @@ static ssize_t fsp_attr_show_pagereg(struct psmouse *psmouse,
static ssize_t fsp_attr_set_pagereg(struct psmouse *psmouse, void *data,
const char *buf, size_t count)
{
int val, err;
unsigned int val;
int err;

err = kstrtoint(buf, 16, &val);
err = kstrtouint(buf, 16, &val);
if (err)
return err;

Expand Down

0 comments on commit 9c8f557

Please sign in to comment.