Skip to contentSkip to conversation

drivers/input/joystick/iforce/iforce-main.c: fix check after use

PATCH New Adrian Bunk 1 participant 1 message Mar 24, 2005 Input drivers

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 drivers/input/joystick/iforce/iforce-main.c: fix check after use

This patch fixes an obvious check after use found by the Coverity checker.

drivers/input/joystick/iforce/iforce-main.c renamed from drivers/input/joystick/iforce/iforce-main.c.old +3 -3
@@ -221,15 +221,15 @@ static int iforce_erase_effect(struct in
 	int err = 0;
 	struct iforce_core_effect* core_effect;
 
+	if (effect_id < 0 || effect_id >= FF_EFFECTS_MAX)
+		return -EINVAL;
+
 	/* Check who is trying to erase this effect */
 	if (iforce->core_effects[effect_id].owner != current->pid) {
 		printk(KERN_WARNING "iforce-main.c: %d tried to erase an effect belonging to %d\n", current->pid, iforce->core_effects[effect_id].owner);
 		return -EACCES;
 	}
 
-	if (effect_id < 0 || effect_id >= FF_EFFECTS_MAX)
-		return -EINVAL;
-
 	core_effect = iforce->core_effects + effect_id;
 
 	if (test_bit(FF_MOD1_IS_USED, core_effect->flags))