meson: pwm: fix coverity warning
authorYingyuan Zhu <yingyuan.zhu@amlogic.com>
Wed, 29 Aug 2018 08:03:36 +0000 (16:03 +0800)
committerJianxin Pan <jianxin.pan@amlogic.com>
Thu, 6 Sep 2018 13:56:21 +0000 (06:56 -0700)
PD#172718: meson: pwm: fix coverity warning

"value < 0" and "value > 255", two conditions cannot be
met simultaneously.So that the if statement cannot be executed.
This causes "Logically dead code".

Change-Id: I55930eb7ae9c6b44aa3b20b85aab6fbae9b04210
Signed-off-by: Yingyuan Zhu <yingyuan.zhu@amlogic.com>
drivers/amlogic/pwm/pwm_meson_sysfs.c

index 46ef478..e507885 100644 (file)
@@ -129,7 +129,7 @@ int pwm_set_times(struct meson_pwm *meson,
 {
        unsigned int clear_val, val;
 
-       if ((value < 0) && (value > 255)) {
+       if ((value < 0) || (value > 255)) {
                dev_err(meson->chip.dev,
                                "index or value is not within the scope!\n");
                return -EINVAL;
@@ -297,7 +297,7 @@ int pwm_set_blink_times(struct meson_pwm *meson,
 {
        unsigned int clear_val, val;
 
-       if ((value < 0) && (value > 15)) {
+       if ((value < 0) || (value > 15)) {
                dev_err(meson->chip.dev,
                "value or index is not within the scope!\n");
                return -EINVAL;