From patchwork Thu Nov 23 19:31:31 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andy Shevchenko X-Patchwork-Id: 13466724 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 450B1C5AD4C for ; Thu, 23 Nov 2023 19:34:49 +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:References:In-Reply-To: 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: List-Owner; bh=jYJE7XpDTr1X6r6NzVv7ERy7ctegoAC+ajH/P3y5iSc=; b=EWMCPS2UenGunT Nv3O7LoTFuu+kjRz6J41BPNDkQ+GziDDsTpvq6wCP7vd8HP1Jg1QAZ42c9ptKk0qLFJ1KVtUW8X9R THc6S7kKRJCeeTURk2G3kc1JxCM+d7C5nqg0pR4E91EHJjhf/CScB1jNH6sZbLJADrryuYBb3/yEN NaPJyVKn1QQt28HJEiwLEPQNHe8ogfP6ZkQJTXL1RK6WvsEcZjpCaFx4ylW5d02i9YrOSCRNShOv/ oGRPnOqVC/FtOUMWy+E/ng9vf7KkIiHO3i9wh4A+uLTN79qoLwNsSILJDTKleMp4mGrQWdRbVvkD0 N+IMyYQ/cpWAUYApKf1w==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.96 #2 (Red Hat Linux)) id 1r6FT2-005bp2-2A; Thu, 23 Nov 2023 19:34:28 +0000 Received: from mgamail.intel.com ([192.55.52.151]) by bombadil.infradead.org with esmtps (Exim 4.96 #2 (Red Hat Linux)) id 1r6FSn-005bcI-0S; Thu, 23 Nov 2023 19:34:14 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1700768053; x=1732304053; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=HR6AD3oucSuNKOYxIpiD/4nGiB6I6Xel00vv5noMc+E=; b=dwKJipLe0K1Q1BHpBt4ixLdkRBUcw8jIF5+VRdoCypsL8XylPlm30WzT 2+1DTLG1eB8WBtyNT+zihwsSxcK/f1hMo+fxpc3P4OF4ZpTJ9tkCEuYpf pcEodYuXJPX1TKtS4DY63+oIuOlOm9HA9QYKe7eqv87hikz5FryO0YBXV dgQAQQjfgc5a2KxvNZ5lOCDIDbeo4Hfo+ZOjJfjudNkt5VQnepZ5tIHkg uMG5t4FHBOTCJDoHhPiFUZj764f2ufRZ2jiX4oFnSUyuhFdyISYXBG3lL pw/6ivGGuCRZpfPNf60IKUbYQ4KA4ye9qaYogIT7TjsXqTb+98ZyIMa8Y w==; X-IronPort-AV: E=McAfee;i="6600,9927,10902"; a="372482062" X-IronPort-AV: E=Sophos;i="6.04,222,1695711600"; d="scan'208";a="372482062" Received: from fmsmga008.fm.intel.com ([10.253.24.58]) by fmsmga107.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 23 Nov 2023 11:34:07 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,10902"; a="833506145" X-IronPort-AV: E=Sophos;i="6.04,222,1695711600"; d="scan'208";a="833506145" Received: from black.fi.intel.com ([10.237.72.28]) by fmsmga008.fm.intel.com with ESMTP; 23 Nov 2023 11:33:59 -0800 Received: by black.fi.intel.com (Postfix, from userid 1003) id A864F387; Thu, 23 Nov 2023 21:33:58 +0200 (EET) From: Andy Shevchenko To: Linus Walleij , Bartosz Golaszewski , Andy Shevchenko , Rasmus Villemoes , =?utf-8?q?Jonathan_Neusch?= =?utf-8?q?=C3=A4fer?= , Krzysztof Kozlowski , =?utf-8?q?Uwe_Kleine-?= =?utf-8?q?K=C3=B6nig?= , Geert Uytterhoeven , Biju Das , Claudiu Beznea , Jianlong Huang , linux-arm-kernel@lists.infradead.org, linux-gpio@vger.kernel.org, linux-kernel@vger.kernel.org, linux-mediatek@lists.infradead.org, openbmc@lists.ozlabs.org, linux-mips@vger.kernel.org, linux-arm-msm@vger.kernel.org, linux-renesas-soc@vger.kernel.org Cc: Ray Jui , Scott Branden , Broadcom internal kernel review list , Dong Aisheng , Fabio Estevam , Shawn Guo , Jacky Bai , Pengutronix Kernel Team , Sascha Hauer , NXP Linux Team , Sean Wang , Paul Cercueil , Lakshmi Sowjanya D , Andy Gross , Bjorn Andersson , Konrad Dybcio , Emil Renner Berthing , Hal Feng Subject: [PATCH v2 03/21] pinctrl: equilibrium: Use temporary variable to hold pins Date: Thu, 23 Nov 2023 21:31:31 +0200 Message-ID: <20231123193355.3400852-4-andriy.shevchenko@linux.intel.com> X-Mailer: git-send-email 2.43.0.rc1.1.gbec44491f096 In-Reply-To: <20231123193355.3400852-1-andriy.shevchenko@linux.intel.com> References: <20231123193355.3400852-1-andriy.shevchenko@linux.intel.com> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20231123_113413_193538_B06AE869 X-CRM114-Status: GOOD ( 12.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 The pins are allocated from the heap, but in order to pass them as constant object, we need to use non-constant pointer. Achieve this by using a temporary variable. Signed-off-by: Andy Shevchenko --- drivers/pinctrl/pinctrl-equilibrium.c | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/drivers/pinctrl/pinctrl-equilibrium.c b/drivers/pinctrl/pinctrl-equilibrium.c index 5b5ddf7e5d0e..91157a2b949c 100644 --- a/drivers/pinctrl/pinctrl-equilibrium.c +++ b/drivers/pinctrl/pinctrl-equilibrium.c @@ -704,7 +704,7 @@ static int eqbr_build_groups(struct eqbr_pinctrl_drv_data *drvdata) { struct device *dev = drvdata->dev; struct device_node *node = dev->of_node; - unsigned int *pinmux, pin_id, pinmux_id; + unsigned int *pins, *pinmux, pin_id, pinmux_id; struct group_desc group; struct device_node *np; struct property *prop; @@ -722,15 +722,14 @@ static int eqbr_build_groups(struct eqbr_pinctrl_drv_data *drvdata) return -EINVAL; } group.name = prop->value; - group.pins = devm_kcalloc(dev, group.num_pins, - sizeof(*(group.pins)), GFP_KERNEL); - if (!group.pins) { + pins = devm_kcalloc(dev, group.num_pins, sizeof(*pins), GFP_KERNEL); + if (!pins) { of_node_put(np); return -ENOMEM; } + group.pins = pins; - pinmux = devm_kcalloc(dev, group.num_pins, sizeof(*pinmux), - GFP_KERNEL); + pinmux = devm_kcalloc(dev, group.num_pins, sizeof(*pinmux), GFP_KERNEL); if (!pinmux) { of_node_put(np); return -ENOMEM; @@ -749,7 +748,7 @@ static int eqbr_build_groups(struct eqbr_pinctrl_drv_data *drvdata) of_node_put(np); return -EINVAL; } - group.pins[j] = pin_id; + pins[j] = pin_id; if (of_property_read_u32_index(np, "pinmux", j, &pinmux_id)) { dev_err(dev, "Group %s: Read intel pinmux id failed\n", group.name);