Просмотр исходного кода

mfd: ab8500-debugfs: Simplify invalid debugfs data checking

Noticed during a coding review, if we reorganised the checking a
little, we can rid the code of a pointless 'else'.  Whilst looking
for this particular code hunk I noticed another pointless 'else',
which I've subsequently fixed in this patch.

Reviewed-by: Linus Walleij <linus.walleij@linaro.org>
Signed-off-by: Lee Jones <lee.jones@linaro.org>
Lee Jones 11 лет назад
Родитель
Сommit
c3f27a26b4
1 измененных файлов с 7 добавлено и 7 удалено
  1. 7 7
      drivers/mfd/ab8500-debugfs.c

+ 7 - 7
drivers/mfd/ab8500-debugfs.c

@@ -2503,14 +2503,14 @@ static ssize_t ab8500_gpadc_trig_timer_write(struct file *file,
 	if (err)
 	if (err)
 		return err;
 		return err;
 
 
-	if (user_trig_timer <= 255) {
-		trig_timer = (u8) user_trig_timer;
-	} else {
-		dev_err(dev, "debugfs error input: "
-			"should be beetween 0 to 255\n");
+	if (user_trig_timer & ~0xFF) {
+		dev_err(dev,
+			"debugfs error input: should be beetween 0 to 255\n");
 		return -EINVAL;
 		return -EINVAL;
 	}
 	}
 
 
+	trig_timer = (u8) user_trig_timer;
+
 	return count;
 	return count;
 }
 }
 
 
@@ -2764,8 +2764,8 @@ static ssize_t show_irq(struct device *dev,
 	irq_index = name - irq_first;
 	irq_index = name - irq_first;
 	if (irq_index >= num_irqs)
 	if (irq_index >= num_irqs)
 		return -EINVAL;
 		return -EINVAL;
-	else
-		return sprintf(buf, "%u\n", irq_count[irq_index]);
+
+	return sprintf(buf, "%u\n", irq_count[irq_index]);
 }
 }
 
 
 static ssize_t ab8500_subscribe_write(struct file *file,
 static ssize_t ab8500_subscribe_write(struct file *file,