From patchwork Fri Feb 3 13:27:14 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Claudiu Beznea X-Patchwork-Id: 13127544 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id E708DC05027 for ; Fri, 3 Feb 2023 13:39:28 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:Message-ID:Date:Subject:CC :To:From:Reply-To:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:In-Reply-To:References: List-Owner; bh=v+9dqJEeSLMLNl5p4QXv6bMO0zvP17dTR8IIH0IW9gE=; b=ygOfRwiiBnxmsp j+Pv4w05YM7N+qmlxOUHlajF2uay7kErsNhe9WEln01x8XMCfLRkbgyup0QkkiKEgE1Yd3KDYTope G5KjnPkKVglOQIY2N1ZqMceoCnNJRdRyC/AKNQghB1Tur35fYdv8w3edVmHfLYdOpovdg8P6CGdDC tCQahSzcXXB2r3F+ZDC7xxIbnesCgeAavFnIYDKM5phPdPgAluz585QMXdB0kkwDWZkfvuRcVKABg 7UIg41CV7PJV5OCCZFuiVcXejfUakOX36vAUBauj3Vghnq/ekQYbnzq40/EYM0KKHc8Nj1Lz2mH2I bu1/8baiuwUl+raFO/KA==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1pNwFO-0025Vs-6q; Fri, 03 Feb 2023 13:37:00 +0000 Received: from esa.microchip.iphmx.com ([68.232.154.123]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1pNw8E-0022z7-3Z for linux-arm-kernel@lists.infradead.org; Fri, 03 Feb 2023 13:29:36 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=microchip.com; i=@microchip.com; q=dns/txt; s=mchp; t=1675430973; x=1706966973; h=from:to:cc:subject:date:message-id:mime-version: content-transfer-encoding; bh=HRL4soUZGhkgOpsuFJTflw9CMFVUDRCcn8Px2h/bpVI=; b=sB0qPTSIQ4BQooEe+3TFHEkVt/2Ih3VII5aD19iKabM1z1asb0JYDW6U aDWExnxOO+azToCsU7NbIysAI6isuZE8HwOB+3Tc8c6EIVHpIFC1AYOTR +/qXmEqsT+nutzAQdgRyeV6dxm5qE/xJapMncaKWWU1RgQ+6/iue6cjTM 0ctHkOyjXIhWNFIHXJTdQ6zCXN6U0N+mHMupphO2+xg5XJ7RMUcx3q9yw liGdNjw0hlw9Wr4Z+bxw/UdSsPCC9SvWC1PM+HHMFTKCHUGW9ZbFrk6en pzZpgyPaQvu4PgBLimLyBb0Z4HR7YVuBWenXcz/3xgEPBUR9W7lNn7zE1 g==; X-IronPort-AV: E=Sophos;i="5.97,270,1669100400"; d="scan'208";a="135441456" Received: from unknown (HELO email.microchip.com) ([170.129.1.10]) by esa6.microchip.iphmx.com with ESMTP/TLS/AES256-SHA256; 03 Feb 2023 06:29:27 -0700 Received: from chn-vm-ex04.mchp-main.com (10.10.85.152) by chn-vm-ex04.mchp-main.com (10.10.85.152) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.16; Fri, 3 Feb 2023 06:29:20 -0700 Received: from m18063-ThinkPad-T460p.mchp-main.com (10.10.115.15) by chn-vm-ex04.mchp-main.com (10.10.85.152) with Microsoft SMTP Server id 15.1.2507.16 via Frontend Transport; Fri, 3 Feb 2023 06:29:18 -0700 From: Claudiu Beznea To: , , , CC: , , , Claudiu Beznea Subject: [PATCH] pinctrl: at91: use devm_kasprintf() to avoid potential leaks Date: Fri, 3 Feb 2023 15:27:14 +0200 Message-ID: <20230203132714.1931596-1-claudiu.beznea@microchip.com> X-Mailer: git-send-email 2.34.1 MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20230203_052934_291251_5ABFF008 X-CRM114-Status: GOOD ( 10.59 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org Use devm_kasprintf() instead of kasprintf() to avoid any potential leaks. At the moment drivers have no remove functionality thus there is no need for fixes tag. Signed-off-by: Claudiu Beznea --- drivers/pinctrl/pinctrl-at91-pio4.c | 4 ++-- drivers/pinctrl/pinctrl-at91.c | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/drivers/pinctrl/pinctrl-at91-pio4.c b/drivers/pinctrl/pinctrl-at91-pio4.c index 39b233f73e13..373eed8bc4be 100644 --- a/drivers/pinctrl/pinctrl-at91-pio4.c +++ b/drivers/pinctrl/pinctrl-at91-pio4.c @@ -1149,8 +1149,8 @@ static int atmel_pinctrl_probe(struct platform_device *pdev) pin_desc[i].number = i; /* Pin naming convention: P(bank_name)(bank_pin_number). */ - pin_desc[i].name = kasprintf(GFP_KERNEL, "P%c%d", - bank + 'A', line); + pin_desc[i].name = devm_kasprintf(&pdev->dev, GFP_KERNEL, "P%c%d", + bank + 'A', line); group->name = group_names[i] = pin_desc[i].name; group->pin = pin_desc[i].number; diff --git a/drivers/pinctrl/pinctrl-at91.c b/drivers/pinctrl/pinctrl-at91.c index 1e1813d7c550..c405296e4989 100644 --- a/drivers/pinctrl/pinctrl-at91.c +++ b/drivers/pinctrl/pinctrl-at91.c @@ -1885,7 +1885,7 @@ static int at91_gpio_probe(struct platform_device *pdev) } for (i = 0; i < chip->ngpio; i++) - names[i] = kasprintf(GFP_KERNEL, "pio%c%d", alias_idx + 'A', i); + names[i] = devm_kasprintf(&pdev->dev, GFP_KERNEL, "pio%c%d", alias_idx + 'A', i); chip->names = (const char *const *)names;