Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751595AbdITHG4 (ORCPT ); Wed, 20 Sep 2017 03:06:56 -0400 Received: from mail-pg0-f66.google.com ([74.125.83.66]:33449 "EHLO mail-pg0-f66.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751000AbdITHGy (ORCPT ); Wed, 20 Sep 2017 03:06:54 -0400 X-Google-Smtp-Source: AOwi7QAmtSKkeXOxbp8jJkagU72OSAC0OcFKJiPDPTZZ/rC4Vxbx9GaTAQKHbvCLg1jHswFZHNlQYQ== From: Arvind Yadav To: kishon@ti.com, thierry.reding@gmail.com, jonathanh@nvidia.com Cc: linux-kernel@vger.kernel.org, linux-tegra@vger.kernel.org Subject: [PATCH] phy: tegra: Handle return value of kasprintf Date: Wed, 20 Sep 2017 12:35:57 +0530 Message-Id: <0a121b1761f0dc8fe9c5020e8d5c6dfd48c9a242.1505884381.git.arvind.yadav.cs@gmail.com> X-Mailer: git-send-email 1.9.1 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 577 Lines: 22 kasprintf() can fail here and we must check its return value. Signed-off-by: Arvind Yadav --- drivers/phy/tegra/xusb.c | 2 ++ 1 file changed, 2 insertions(+) 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); } -- 1.9.1