diff options
author | Naga Radhesh <naga.radheshy@stericsson.com> | 2011-10-17 13:29:00 +0530 |
---|---|---|
committer | Philippe Langlais <philippe.langlais@stericsson.com> | 2012-05-22 11:01:08 +0200 |
commit | 79f46aa4d1b5cffd8bf19a6413cbf61c5b5fe817 (patch) | |
tree | 95ea974297a80e938309a8d9afb242dc561ba19e | |
parent | 5c1c7cce37d64233331b944e1182908a1e7030c4 (diff) |
drivers/leds/leds-lp5521.c: change the return value
In sscanf,execution of a %n directive
does not always increment the assignment count
returned, so ret value need not be 2 always.
ST-Ericsson ID: 361235
ST-Ericsson Linux next: -
ST-Ericsson FOSS-OUT ID: Trivial
Signed-off-by: Naga Radhesh <naga.radheshy@stericsson.com>
Change-Id:I7fb54aba0fbbc94d6cdef67f79709c46153a81dc
Reviewed-on: http://gerrit.lud.stericsson.com/gerrit/34156
Reviewed-by: Srinidhi KASAGAR <srinidhi.kasagar@stericsson.com>
-rw-r--r-- | drivers/leds/leds-lp5521.c | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/drivers/leds/leds-lp5521.c b/drivers/leds/leds-lp5521.c index 410a723b869..75ade5792c3 100644 --- a/drivers/leds/leds-lp5521.c +++ b/drivers/leds/leds-lp5521.c @@ -355,7 +355,12 @@ static int lp5521_do_store_load(struct lp5521_engine *engine, while ((offset < len - 1) && (i < LP5521_PROGRAM_LENGTH)) { /* separate sscanfs because length is working only for %s */ ret = sscanf(buf + offset, "%2s%n ", c, &nrchars); - if (ret != 2) + /* + * Execution of a %n directive does not always + * increment the assignment count returned at + * completion of execution.so ret need not be 2 + */ + if ((ret != 1) && (ret != 2)) goto fail; ret = sscanf(c, "%2x", &cmd); if (ret != 1) |