From 310ae37edb3becedf5da904201f3439ea42ab12f Mon Sep 17 00:00:00 2001 From: Thomas Huth Date: Tue, 25 Aug 2015 17:09:40 +0200 Subject: Fix bad return value checks (detected with Coccinelle) In the "Getting Started with Coccinelle - KVM edition" presentation that has been held by Julia Lawall at the KVM forum 2015 (see the slides at http://events.linuxfoundation.org/sites/events/files/slides/tutorial_kvm_0.pdf), she pointed out some bad return value checks in U-Boot that can be detected with Coccinelle by using the following config file: @@ identifier x,y; identifier f; statement S; @@ x = f(...); ( if (x < 0) S | if ( - y + x < 0) S ) This patch now fixes these issues. Signed-off-by: Thomas Huth --- drivers/hwmon/lm81.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'drivers/hwmon/lm81.c') diff --git a/drivers/hwmon/lm81.c b/drivers/hwmon/lm81.c index c1fc42a..bcc8d32 100644 --- a/drivers/hwmon/lm81.c +++ b/drivers/hwmon/lm81.c @@ -90,7 +90,7 @@ int dtt_init_one(int sensor) if (adr < 0) return 1; rev = dtt_read (sensor, DTT_REV); - if (adr < 0) + if (rev < 0) return 1; debug ("DTT: Found LM81@%x Rev: %d\n", adr, rev); -- cgit v1.1