Commit 7ea2aa2046a15af1c048115e7c05f1ba1566899d

Authored by Wolfram Sang
Committed by Grant Likely
1 parent f0eb824bee

gpio: pca953x: propagate the errno from the chip_init functions

Initializing the chips may return with an error, but this error gets
dropped in probe(). Propagate this further to the driver core. Also,
simplify returning the error in one of the init functions.

Signed-off-by: Wolfram Sang <w.sang@pengutronix.de>
Cc: Grant Likely <grant.likely@secretlab.ca>
Signed-off-by: Grant Likely <grant.likely@secretlab.ca>

Showing 1 changed file with 5 additions and 6 deletions Side-by-side Diff

drivers/gpio/gpio-pca953x.c
... ... @@ -595,9 +595,6 @@
595 595  
596 596 /* set platform specific polarity inversion */
597 597 ret = pca953x_write_reg(chip, PCA953X_INVERT, invert);
598   - if (ret)
599   - goto out;
600   - return 0;
601 598 out:
602 599 return ret;
603 600 }
... ... @@ -639,7 +636,7 @@
639 636 struct pca953x_platform_data *pdata;
640 637 struct pca953x_chip *chip;
641 638 int irq_base=0, invert=0;
642   - int ret = 0;
  639 + int ret;
643 640  
644 641 chip = kzalloc(sizeof(struct pca953x_chip), GFP_KERNEL);
645 642 if (chip == NULL)
646 643  
... ... @@ -672,9 +669,11 @@
672 669 pca953x_setup_gpio(chip, id->driver_data & PCA_GPIO_MASK);
673 670  
674 671 if (chip->chip_type == PCA953X_TYPE)
675   - device_pca953x_init(chip, invert);
  672 + ret = device_pca953x_init(chip, invert);
676 673 else
677   - device_pca957x_init(chip, invert);
  674 + ret = device_pca957x_init(chip, invert);
  675 + if (ret)
  676 + goto out_failed;
678 677  
679 678 ret = pca953x_irq_setup(chip, id, irq_base);
680 679 if (ret)