]> git.karo-electronics.de Git - linux-beck.git/commitdiff
thermal: kirkwood: Fix valid check for thermal register
authorEzequiel Garcia <ezequiel.garcia@free-electrons.com>
Thu, 21 Mar 2013 20:42:07 +0000 (17:42 -0300)
committerZhang Rui <rui.zhang@intel.com>
Tue, 26 Mar 2013 14:09:14 +0000 (22:09 +0800)
The correct value is obtain by first shifting the register by the offset,
later applying the valid mask and finally invert the result.
This check was lacking an extra parenthesis to be strictly correct.

Signed-off-by: Ezequiel Garcia <ezequiel.garcia@free-electrons.com>
Signed-off-by: Zhang Rui <rui.zhang@intel.com>
drivers/thermal/kirkwood_thermal.c

index e5500edb528568a009597b9336fa3d951df852ac..d2e05eec722aa4e8bf388cf3687ba2e316b146ca 100644 (file)
@@ -41,8 +41,8 @@ static int kirkwood_get_temp(struct thermal_zone_device *thermal,
        reg = readl_relaxed(priv->sensor);
 
        /* Valid check */
-       if (!(reg >> KIRKWOOD_THERMAL_VALID_OFFSET) &
-           KIRKWOOD_THERMAL_VALID_MASK) {
+       if (!((reg >> KIRKWOOD_THERMAL_VALID_OFFSET) &
+           KIRKWOOD_THERMAL_VALID_MASK)) {
                dev_err(&thermal->device,
                        "Temperature sensor reading not valid\n");
                return -EIO;