diff mbox series

[U-Boot,4/4] dm: gpio: pca953x: Drop pointless data structure checks

Message ID 20170917225455.116717-4-sjg@chromium.org
State Accepted
Commit ae06a1b9960aa97bd876840ebdb644c2952cd482
Delegated to: Simon Glass
Headers show
Series [U-Boot,1/4] dm: gpio: vybrid_gpio: Correct driver's use of bind() method | expand

Commit Message

Simon Glass Sept. 17, 2017, 10:54 p.m. UTC
These checks cannot fail since driver model will not call a driver's
method if it cannot fully create the driver data structures.

It is confusing to have these checks and others might copy them. Drop this
code.

Signed-off-by: Simon Glass <sjg@chromium.org>
---

 drivers/gpio/pca953x_gpio.c | 11 -----------
 1 file changed, 11 deletions(-)

Comments

Simon Glass Sept. 29, 2017, 9 p.m. UTC | #1
These checks cannot fail since driver model will not call a driver's
method if it cannot fully create the driver data structures.

It is confusing to have these checks and others might copy them. Drop this
code.

Signed-off-by: Simon Glass <sjg@chromium.org>
---

 drivers/gpio/pca953x_gpio.c | 11 -----------
 1 file changed, 11 deletions(-)

Applied to u-boot-dm thanks!
diff mbox series

Patch

diff --git a/drivers/gpio/pca953x_gpio.c b/drivers/gpio/pca953x_gpio.c
index 4962f25230..791d1d1516 100644
--- a/drivers/gpio/pca953x_gpio.c
+++ b/drivers/gpio/pca953x_gpio.c
@@ -249,22 +249,11 @@  static int pca953x_probe(struct udevice *dev)
 {
 	struct pca953x_info *info = dev_get_platdata(dev);
 	struct gpio_dev_priv *uc_priv = dev_get_uclass_priv(dev);
-	struct dm_i2c_chip *chip = dev_get_parent_platdata(dev);
 	char name[32], *str;
 	int addr;
 	ulong driver_data;
 	int ret;
 
-	if (!info) {
-		dev_err(dev, "platdata not ready\n");
-		return -ENOMEM;
-	}
-
-	if (!chip) {
-		dev_err(dev, "i2c not ready\n");
-		return -ENODEV;
-	}
-
 	addr = fdtdec_get_int(gd->fdt_blob, dev_of_offset(dev), "reg", 0);
 	if (addr == 0)
 		return -ENODEV;