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

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

From: Stephen Boyd <hidden>
Date: 2018-03-21 20:17:59
Also in: linux-arm-msm, linux-devicetree, linux-gpio, lkml

Quoting Stephen Boyd (2018-03-21 09:58:48)
+       ret = device_property_read_u16_array(pctrl->dev, "gpios", NULL, 0);
+       if (ret > 0 && ret < max_gpios) {
+               u16 *tmp;
+
+               len = ret;
+               tmp = kmalloc_array(len, sizeof(tmp[0]), GFP_KERNEL);
+               if (!tmp)
+                       return -ENOMEM;
+
+               ret = device_property_read_u16_array(pctrl->dev, "gpios", tmp,
+                                                    len);
+               if (ret < 0) {
+                       dev_err(pctrl->dev, "could not read list of GPIOs\n");
+                       kfree(tmp);
+                       return ret;
+               }
+
+               bitmap_zero(chip->valid_mask, max_gpios);
+               for (i = 0; i < len; i++)
+                       set_bit(tmp[i], chip->valid_mask);
This leaks tmp too.. I'll fix that in v4 and resend tomorrow if there
aren't more comments.
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help