[PATCH 2/2] firmware: altera-serial: simplify handling of optional gpio

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Signed-off-by: Uwe Kleine-König <u.kleine-koenig@xxxxxxxxxxxxxx>
---
 drivers/firmware/altera_serial.c | 12 +++++-------
 1 file changed, 5 insertions(+), 7 deletions(-)

diff --git a/drivers/firmware/altera_serial.c b/drivers/firmware/altera_serial.c
index 5486d9ec63e9..ddee991ed073 100644
--- a/drivers/firmware/altera_serial.c
+++ b/drivers/firmware/altera_serial.c
@@ -221,15 +221,13 @@ static int altera_spi_of(struct device_d *dev, struct fpga_spi *this)
 	int ret;
 
 	name = "nstat-gpios";
-	if (!of_get_property(n, name, NULL)) {
+	this->nstat_gpio = of_get_named_gpio(n, name, 0);
+	if (this->nstat_gpio == -ENOENT) {
 		dev_info(dev, "nstat-gpio is not specified, assuming it is not connected\n");
 		this->nstat_gpio = -1;
-	} else {
-		this->nstat_gpio = of_get_named_gpio(n, name, 0);
-		if (this->nstat_gpio < 0) {
-			ret = this->nstat_gpio;
-			goto out;
-		}
+	} else if (this->nstat_gpio < 0) {
+		ret = this->nstat_gpio;
+		goto out;
 	}
 
 	name = "confd-gpios";
-- 
2.9.3


_______________________________________________
barebox mailing list
barebox@xxxxxxxxxxxxxxxxxxx
http://lists.infradead.org/mailman/listinfo/barebox




[Index of Archives]     [Linux Embedded]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [XFree86]

  Powered by Linux