From: Peng Fan Date: Tue, 24 Nov 2015 08:54:21 +0000 (+0800) Subject: common: cli_hush: avoid dead code X-Git-Tag: v2016.01-rc2~39 X-Git-Url: https://git.sur5r.net/?a=commitdiff_plain;h=aa722529635c16c52d9d609122fecc96ec8d03e4;p=u-boot 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 Cc: Rabin Vincent Cc: Simon Glass Cc: Tom Rini Reviewed-by: Simon Glass --- diff --git a/common/cli_hush.c b/common/cli_hush.c index a7cac4fcb9..f075459911 100644 --- a/common/cli_hush.c +++ b/common/cli_hush.c @@ -2162,7 +2162,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; }