lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Date: Fri, 31 May 2024 15:44:11 -0700
From: Curtis Klein <curtis.klein@....com>
To: giometti@...eenne.com
Cc: linux-kernel@...r.kernel.org, Curtis Klein <curtis.klein@....com>
Subject: [PATCH] pps: clients: gpio: Continue after failing to get optional ECHO pin

Warn but do not fail when devm_gpiod_get_optional returns an error when
trying to get the ECHO pin. When creating a pps-gpio device using
platform data and GPIO lookup tables, the call to gpiod_get_optional
will match on the unlabeled pin meant as the input when searching for
the "echo" pin. Since it is already in use as the PPS input, it will
fail with -EBUSY. As the ECHO pin is optional, we just warn on the error
and continue the initialization. This allows us to support devices
created using GPIO lookup tables instead of ACPI, DT, swnode, etc.

Signed-off-by: Curtis Klein <curtis.klein@....com>
---
 drivers/pps/clients/pps-gpio.c | 9 ++++++---
 1 file changed, 6 insertions(+), 3 deletions(-)

diff --git a/drivers/pps/clients/pps-gpio.c b/drivers/pps/clients/pps-gpio.c
index 2f4b11b4dfcd..b7db4a3ee97e 100644
--- a/drivers/pps/clients/pps-gpio.c
+++ b/drivers/pps/clients/pps-gpio.c
@@ -114,9 +114,12 @@ static int pps_gpio_setup(struct device *dev)
 		device_property_read_bool(dev, "assert-falling-edge");
 
 	data->echo_pin = devm_gpiod_get_optional(dev, "echo", GPIOD_OUT_LOW);
-	if (IS_ERR(data->echo_pin))
-		return dev_err_probe(dev, PTR_ERR(data->echo_pin),
-				     "failed to request ECHO GPIO\n");
+	if (IS_ERR(data->echo_pin)) {
+		dev_warn(dev, "failed to request ECHO GPIO: %ld\n",
+			 PTR_ERR(data->echo_pin));
+		data->echo_pin = NULL;
+		return 0;
+	}
 
 	if (!data->echo_pin)
 		return 0;
-- 
2.34.1


Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ