summaryrefslogtreecommitdiff
path: root/common
diff options
context:
space:
mode:
authorPeng Fan <Peng.Fan@freescale.com>2015-11-24 16:54:21 +0800
committerguoyin.chen <guoyin.chen@freescale.com>2016-03-04 15:35:52 +0800
commitbe02b39ef5eb4afd323e12c69792e234a29b380b (patch)
treecaf5d28d5378561702f540b8b0f11dc27b1986d9 /common
parent79757d63a38c11751c9ff773915a28f5d2641349 (diff)
downloadu-boot-imx-be02b39ef5eb4afd323e12c69792e234a29b380b.zip
u-boot-imx-be02b39ef5eb4afd323e12c69792e234a29b380b.tar.gz
u-boot-imx-be02b39ef5eb4afd323e12c69792e234a29b380b.tar.bz2
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> (cherry picked from commit aa722529635c16c52d9d609122fecc96ec8d03e4)
Diffstat (limited to 'common')
-rw-r--r--common/cli_hush.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/common/cli_hush.c b/common/cli_hush.c
index 296542f..5d78463 100644
--- a/common/cli_hush.c
+++ b/common/cli_hush.c
@@ -2161,7 +2161,7 @@ int set_local_var(const char *s, int flg_export)
* NAME=VALUE format. So the first order of business is to
* split 's' on the '=' into 'name' and 'value' */
value = strchr(name, '=');
- if (value == NULL && ++value == NULL) {
+ if (value == NULL || *(value + 1) == 0) {
free(name);
return -1;
}