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-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20231019173457.2445119-4-andriy.shevchenko@linux.intel.com>
Date:   Thu, 19 Oct 2023 20:34:57 +0300
From:   Andy Shevchenko <andriy.shevchenko@...ux.intel.com>
To:     Andy Shevchenko <andriy.shevchenko@...ux.intel.com>,
        Dmitry Torokhov <dmitry.torokhov@...il.com>,
        Bartosz Golaszewski <bartosz.golaszewski@...aro.org>,
        Linus Walleij <linus.walleij@...aro.org>,
        linux-gpio@...r.kernel.org, linux-acpi@...r.kernel.org,
        linux-kernel@...r.kernel.org
Cc:     Mika Westerberg <mika.westerberg@...ux.intel.com>,
        Bartosz Golaszewski <brgl@...ev.pl>,
        Hans de Goede <hdegoede@...hat.com>,
        Ferry Toth <ftoth@...londelft.nl>
Subject: [PATCH v1 3/3] gpiolib: Make debug messages in gpiod_find_by_fwnode() less confusing

Currently the extended debug messages have added confusion,
but value when con_id is NULL, which is the case for, e.g.,
GPIO LEDs.

Improve the messaging by using GPIO function name rather than con_id.
This requires to split and move the second part after the respective
calls.

Reported-by: Ferry Toth <ftoth@...londelft.nl>
Fixes: 8eb1f71e7acc ("gpiolib: consolidate GPIO lookups")
Signed-off-by: Andy Shevchenko <andriy.shevchenko@...ux.intel.com>
---
 drivers/gpio/gpiolib.c | 17 ++++++++---------
 1 file changed, 8 insertions(+), 9 deletions(-)

diff --git a/drivers/gpio/gpiolib.c b/drivers/gpio/gpiolib.c
index beac3031246e..2cc275fb62b6 100644
--- a/drivers/gpio/gpiolib.c
+++ b/drivers/gpio/gpiolib.c
@@ -3946,18 +3946,15 @@ static struct gpio_desc *gpiod_find_by_fwnode(struct fwnode_handle *fwnode,
 	struct gpio_desc *desc = ERR_PTR(-ENOENT);
 
 	if (is_of_node(fwnode)) {
-		dev_dbg(consumer, "using DT '%pfw' for '%s' GPIO lookup\n",
-			fwnode, con_id);
+		dev_dbg(consumer, "using DT '%pfw' for GPIO lookup\n", fwnode);
 		desc = of_find_gpio(to_of_node(fwnode), con_id, idx, propname, propsize,
 				    lookupflags);
 	} else if (is_acpi_node(fwnode)) {
-		dev_dbg(consumer, "using ACPI '%pfw' for '%s' GPIO lookup\n",
-			fwnode, con_id);
+		dev_dbg(consumer, "using ACPI '%pfw' for GPIO lookup\n", fwnode);
 		desc = acpi_find_gpio(fwnode, con_id, idx, propname, propsize,
 				      flags, lookupflags);
 	} else if (is_software_node(fwnode)) {
-		dev_dbg(consumer, "using swnode '%pfw' for '%s' GPIO lookup\n",
-			fwnode, con_id);
+		dev_dbg(consumer, "using swnode '%pfw' for GPIO lookup\n", fwnode);
 		desc = swnode_find_gpio(fwnode, con_id, idx, propname, propsize,
 					lookupflags);
 	}
@@ -3993,10 +3990,12 @@ static struct gpio_desc *gpiod_find_and_request(struct device *consumer,
 	}
 
 	if (IS_ERR(desc)) {
-		dev_dbg(consumer, "No GPIO consumer %s found\n", con_id);
+		dev_dbg(consumer, "No GPIO descriptor for '%s' found\n", funcname);
 		return desc;
 	}
 
+	dev_dbg(consumer, "Found GPIO descriptor for '%s'\n", funcname);
+
 	/*
 	 * If a connection label was passed use that, else attempt to use
 	 * the device name as label
@@ -4015,13 +4014,13 @@ static struct gpio_desc *gpiod_find_and_request(struct device *consumer,
 		 * FIXME: Make this more sane and safe.
 		 */
 		dev_info(consumer,
-			 "nonexclusive access to GPIO for %s\n", con_id);
+			 "nonexclusive access to GPIO for %s\n", funcname);
 		return desc;
 	}
 
 	ret = gpiod_configure_flags(desc, funcname, lookupflags, flags);
 	if (ret < 0) {
-		dev_dbg(consumer, "setup of GPIO %s failed\n", con_id);
+		dev_dbg(consumer, "setup of GPIO %s failed\n", funcname);
 		gpiod_put(desc);
 		return ERR_PTR(ret);
 	}
-- 
2.40.0.1.gaa8946217a0b

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ