phy: tegra: Handle return value of kasprintf

Message ID 0a121b1761f0dc8fe9c5020e8d5c6dfd48c9a242.1505884381.git.arvind.yadav.cs@gmail.com
State Accepted
Headers show
Series
  • phy: tegra: Handle return value of kasprintf
Related show

Commit Message

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

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

Patch

diff --git a/drivers/phy/tegra/xusb.c b/drivers/phy/tegra/xusb.c
index 3cbcb25..4307bf0 100644
--- a/drivers/phy/tegra/xusb.c
+++ b/drivers/phy/tegra/xusb.c
@@ -454,6 +454,8 @@  struct tegra_xusb_lane *
 		char *name;
 
 		name = kasprintf(GFP_KERNEL, "%s-%u", type, index);
+		if (!name)
+			return ERR_PTR(-ENOMEM);
 		np = of_find_node_by_name(np, name);
 		kfree(name);
 	}