diff mbox series

[2/2] gpio: tb10x: Handle return value of devm_kasprintf

Message ID 1505891589-6632-3-git-send-email-arvind.yadav.cs@gmail.com
State New
Headers show
Series Handle return value of devm_kasprintf | expand

Commit Message

Arvind Yadav Sept. 20, 2017, 7:13 a.m. UTC
devm_kasprintf() can fail here and we must check its return value.

Signed-off-by: Arvind Yadav <arvind.yadav.cs@gmail.com>
---
 drivers/gpio/gpio-tb10x.c | 3 +++
 1 file changed, 3 insertions(+)

Comments

Linus Walleij Sept. 21, 2017, 12:14 p.m. UTC | #1
On Wed, Sep 20, 2017 at 9:13 AM, Arvind Yadav <arvind.yadav.cs@gmail.com> wrote:

> devm_kasprintf() can fail here and we must check its return value.
>
> Signed-off-by: Arvind Yadav <arvind.yadav.cs@gmail.com>

Patch applied.

Yours,
Linus Walleij
--
To unsubscribe from this list: send the line "unsubscribe linux-gpio" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
diff mbox series

Patch

diff --git a/drivers/gpio/gpio-tb10x.c b/drivers/gpio/gpio-tb10x.c
index 091ffaa..ac6f2a9 100644
--- a/drivers/gpio/gpio-tb10x.c
+++ b/drivers/gpio/gpio-tb10x.c
@@ -193,6 +193,9 @@  static int tb10x_gpio_probe(struct platform_device *pdev)
 
 	tb10x_gpio->gc.label		=
 		devm_kasprintf(&pdev->dev, GFP_KERNEL, "%pOF", pdev->dev.of_node);
+	if (!tb10x_gpio->gc.label)
+		return -ENOMEM;
+
 	tb10x_gpio->gc.parent		= &pdev->dev;
 	tb10x_gpio->gc.owner		= THIS_MODULE;
 	tb10x_gpio->gc.direction_input	= tb10x_gpio_direction_in;