Skip to contentSkip to conversation

ov5640: Remove unneeded gpiod NULL check

PATCH In review Fabio Estevam 2 participants 2 messages Jul 20, 2017 – Jul 22, 2017

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 ov5640: Remove unneeded gpiod NULL check

From: Fabio Estevam <[email protected]>

The gpiod API checks for NULL descriptors, so there is no need to duplicate the check in the driver.

---
 drivers/media/i2c/ov5640.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)
drivers/media/i2c/ov5640.c +1 -2
index 1f5b483..39a2269 100644
@@ -1524,8 +1524,7 @@ static int ov5640_restore_mode(struct ov5640_dev *sensor)
 
 static void ov5640_power(struct ov5640_dev *sensor, bool enable)
 {
-	if (sensor->pwdn_gpio)
-		gpiod_set_value(sensor->pwdn_gpio, enable ? 0 : 1);
+	gpiod_set_value(sensor->pwdn_gpio, enable ? 0 : 1);
 }
 
 static void ov5640_reset(struct ov5640_dev *sensor)
Signature · 1 line
2.7.4
maintainer Acked-by on v1 1/1
#1 lore raw
Quoted 25 lines · Fabio Estevam

From: Fabio Estevam <[email protected]>

The gpiod API checks for NULL descriptors, so there is no need to duplicate the check in the driver.

---
  drivers/media/i2c/ov5640.c | 3 +--
  1 file changed, 1 insertion(+), 2 deletions(-)
drivers/media/i2c/ov5640.c +1 -2
index 1f5b483..39a2269 100644
@@ -1524,8 +1524,7 @@ static int ov5640_restore_mode(struct ov5640_dev *sensor)
 
  static void ov5640_power(struct ov5640_dev *sensor, bool enable)
  {
-	if (sensor->pwdn_gpio)
-		gpiod_set_value(sensor->pwdn_gpio, enable ? 0 : 1);
+	gpiod_set_value(sensor->pwdn_gpio, enable ? 0 : 1);
  }
 
  static void ov5640_reset(struct ov5640_dev *sensor)