mfd: cros_ec_spi: Repair comparison ordering issue
authorLee Jones <lee.jones@linaro.org>
Wed, 28 Oct 2015 16:42:45 +0000 (16:42 +0000)
committerLee Jones <lee.jones@linaro.org>
Thu, 14 Jan 2016 08:44:01 +0000 (08:44 +0000)
WARNING: Comparisons should place the constant on the right side of the test
+       BUG_ON(EC_MSG_PREAMBLE_COUNT > ec_dev->din_size);

WARNING: Comparisons should place the constant on the right side of the test
+       BUG_ON(EC_MSG_PREAMBLE_COUNT > ec_dev->din_size);

total: 0 errors, 2 warnings, 731 lines checked

Signed-off-by: Lee Jones <lee.jones@linaro.org>
drivers/mfd/cros_ec_spi.c

index d6af52d18c069882344ee39a041be6001bd1e5c8..ebe9b9477cb283fabf0b9f570dcefad13814ef67 100644 (file)
@@ -175,7 +175,7 @@ static int cros_ec_spi_receive_packet(struct cros_ec_device *ec_dev,
        unsigned long deadline;
        int todo;
 
-       BUG_ON(EC_MSG_PREAMBLE_COUNT > ec_dev->din_size);
+       BUG_ON(ec_dev->din_size < EC_MSG_PREAMBLE_COUNT);
 
        /* Receive data until we see the header byte */
        deadline = jiffies + msecs_to_jiffies(EC_MSG_DEADLINE_MS);
@@ -283,7 +283,7 @@ static int cros_ec_spi_receive_response(struct cros_ec_device *ec_dev,
        unsigned long deadline;
        int todo;
 
-       BUG_ON(EC_MSG_PREAMBLE_COUNT > ec_dev->din_size);
+       BUG_ON(ec_dev->din_size < EC_MSG_PREAMBLE_COUNT);
 
        /* Receive data until we see the header byte */
        deadline = jiffies + msecs_to_jiffies(EC_MSG_DEADLINE_MS);