Thread (23 messages) 23 messages, 5 authors, 2018-03-27

Re: [PATCH v3 3/3] pinctrl: qcom: Don't allow protected pins to be requested

From: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Date: 2018-03-23 11:36:12
Also in: linux-arm-kernel, linux-arm-msm, linux-gpio, lkml

On Thu, 2018-03-22 at 19:16 -0500, Timur Tabi wrote:
On 03/21/2018 11:58 AM, Stephen Boyd wrote:
quoted
+static int msm_gpio_init_valid_mask(struct gpio_chip *chip,
+				    struct msm_pinctrl *pctrl)
+{
+	int ret;
+	unsigned int len, i;
+	unsigned int max_gpios = pctrl->soc->ngpios;
+
+	/* The number of GPIOs in the ACPI tables */
+	ret = device_property_read_u16_array(pctrl->dev, "gpios",
NULL, 0);
+	if (ret > 0 && ret < max_gpios) {
This needs to be ret <= max_gpios, otherwise it will fail if every
GPIO 
is available.

And it should print an error message and return an error code if ret
quoted
max_gpios.
Perhaps makes sense to do the opposite condition

if (ret < 0 || ret > max_gpios) {
 ... error handling ...
}

-- 
Andy Shevchenko [off-list ref]
Intel Finland Oy
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help