diff options
author | Naga Radhesh <naga.radheshy@stericsson.com> | 2011-10-17 13:29:00 +0530 |
---|---|---|
committer | Srinidhi KASAGAR <srinidhi.kasagar@stericsson.com> | 2011-10-19 13:34:02 +0200 |
commit | 49edba7f8885569185ffa81a95736f874710de02 (patch) | |
tree | 9a317c59927721d47d4b004dcb49f388481d5e92 /drivers/leds | |
parent | 1c0c175259419c2512f7113feeeff2d44081b5e9 (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>
Diffstat (limited to 'drivers/leds')
-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 6314d5fe76d..e72091ef926 100644 --- a/drivers/leds/leds-lp5521.c +++ b/drivers/leds/leds-lp5521.c @@ -361,7 +361,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) |