Commit aa722529635c16c52d9d609122fecc96ec8d03e4

Authored by Peng Fan
Committed by Tom Rini
1 parent bc3c89b130

common: cli_hush: avoid dead code

Condition "(value == NULL && ++value == NULL)" actully will
always return false.

Instead, use condition "(value == NULL || *(value + 1) == 0)" to detect
such expression "c=". To "c=", *(value + 1) is 0, so directly return -1,
but not continue.

Signed-off-by: Peng Fan <Peng.Fan@freescale.com>
Cc: Rabin Vincent <rabin@rab.in>
Cc: Simon Glass <sjg@chromium.org>
Cc: Tom Rini <trini@konsulko.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

Showing 1 changed file with 1 additions and 1 deletions Side-by-side Diff

... ... @@ -2162,7 +2162,7 @@
2162 2162 * NAME=VALUE format. So the first order of business is to
2163 2163 * split 's' on the '=' into 'name' and 'value' */
2164 2164 value = strchr(name, '=');
2165   - if (value == NULL && ++value == NULL) {
  2165 + if (value == NULL || *(value + 1) == 0) {
2166 2166 free(name);
2167 2167 return -1;
2168 2168 }