Received: by 2002:a05:7412:419a:b0:f3:1519:9f41 with SMTP id i26csp4706427rdh; Wed, 29 Nov 2023 08:28:53 -0800 (PST) X-Google-Smtp-Source: AGHT+IGzJ5LQg+nnwn7HWYCoyFBvvIzk+5k74R+thPVs6ifCI+UwxCfP0uAW6VAuqW7Ld8wRaoU+ X-Received: by 2002:a17:90b:30cb:b0:281:3a4a:2e61 with SMTP id hi11-20020a17090b30cb00b002813a4a2e61mr17186100pjb.14.1701275333616; Wed, 29 Nov 2023 08:28:53 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1701275333; cv=none; d=google.com; s=arc-20160816; b=qpAEa16bd2ipDbxahWzrDvL85J148Lf78qQ74IosSHQhykvguiIx0f4R4NxdNj+S+i bo+dkrdhumYqgjl0uDB4o+e3IoghuX6kXle54fvvccxbhjxGR8Wrg4P9fXWD+JjdhRrU L8rYG8SxCr1w/r5iLop24/XAXeqtSKVpQYJb9VF2W7bpwIVDS/vDLyuGXbP++9cGYEy3 5eWs5d36S48XQAcWD1qslWKTZVk/B9I9IDNaBWQVCYoGwD4sSl9aRWf5iMLAOXloslHn 0YyeCWevIW4pn02cyNippNpi0uZ2vsDh5TBQo4rqFBBdiwRjo0p1hvnbcXQDc4B4dVnT f1hg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=FxzKhYM/0Sg0zBNGbFDWdCpkW1uvPcAWRwicin9BmMw=; fh=p5qGgOuQ1qdHRKXQ3E7ZkEX+heMqfz4xi8z6J8C0/aQ=; b=EqibrOCzDNts1QmWajhFe7eVdCkIoMET/YbR6n2kUCidZmVf4cJmBxqBIY8UaddKJj Y9KQOVRa8NRnX2BecI7FnzmYay0Ala2UCfBR/a87jyQ+hDydhu6vAkJRIaLEomSNHIpu VhFCnOFoM9yOYJA6G+fG26obTu9qHIaKPyNOL0O9R6D73x3HjKDGELHm2MrfurTWMyyp jZkYvV/QRuFEh3hzGiYbTf6Xk992OAueQtET7/ErHmeGPclYiHAzDeTa25STAFGqbtCS 0FUfEbDFNkqGSAxwt1Fk4nIIFmuL+nxCBZysHOJIByUWFN+2xinKYQmMgsOl1siAv+/m zl4A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=gh9rZSDO; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.37 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com Return-Path: Received: from snail.vger.email (snail.vger.email. [23.128.96.37]) by mx.google.com with ESMTPS id cq8-20020a17090af98800b00280a4a15cddsi1573822pjb.94.2023.11.29.08.28.53 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 29 Nov 2023 08:28:53 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.37 as permitted sender) client-ip=23.128.96.37; Authentication-Results: mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=gh9rZSDO; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.37 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by snail.vger.email (Postfix) with ESMTP id 895B680BC50F; Wed, 29 Nov 2023 08:28:52 -0800 (PST) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.11 at snail.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231243AbjK2QPO (ORCPT + 99 others); Wed, 29 Nov 2023 11:15:14 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:47758 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229887AbjK2QPH (ORCPT ); Wed, 29 Nov 2023 11:15:07 -0500 Received: from mgamail.intel.com (mgamail.intel.com [192.55.52.151]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 33863D5E; Wed, 29 Nov 2023 08:15:14 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1701274514; x=1732810514; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=NbQPPAhSXc+lH2scgSPRWjHrBuSZh78A/g5NEt950rk=; b=gh9rZSDOer66IGuFShcZ2xoons/WH5cRI3+Vo1ntdjnBMyrvXLBbvj1m zGqEtlVNRDUsOx6A5evhqckcaPC8wVeZEKjrALPKO0b1g3WzwM91rWDvs mzflgBGv3T7Wmz1jUiZlyu2MXNVYZJKX3O7oiwv02c0nIAkATIZfKomsj mZ1ztuuuIP2ZiUxZzUXEgx/R5mj7VXGfy1qsiiMNDxqdpaMmndnao56Pb AOFU4nezbWSEnEfc0Pqnng5ckn6yMkxlUQELbQJTgVYqv9WOSDxvVp8VW QPK+dpJePglzHguTUeAzWE3LeQ/gDgq7pTlkpANwJLm7cGhNUZsdLh6Xk Q==; X-IronPort-AV: E=McAfee;i="6600,9927,10909"; a="373372529" X-IronPort-AV: E=Sophos;i="6.04,235,1695711600"; d="scan'208";a="373372529" Received: from orsmga004.jf.intel.com ([10.7.209.38]) by fmsmga107.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 29 Nov 2023 08:15:12 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,10909"; a="892498848" X-IronPort-AV: E=Sophos;i="6.04,235,1695711600"; d="scan'208";a="892498848" Received: from black.fi.intel.com ([10.237.72.28]) by orsmga004.jf.intel.com with ESMTP; 29 Nov 2023 08:15:02 -0800 Received: by black.fi.intel.com (Postfix, from userid 1003) id 5A187A02; Wed, 29 Nov 2023 18:15:01 +0200 (EET) From: Andy Shevchenko To: Linus Walleij , Bartosz Golaszewski , Andy Shevchenko , Rasmus Villemoes , =?UTF-8?q?Jonathan=20Neusch=C3=A4fer?= , Krzysztof Kozlowski , =?UTF-8?q?Uwe=20Kleine-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 , Bjorn Andersson , Andy Gross , Konrad Dybcio , Emil Renner Berthing , Hal Feng Subject: [PATCH v4 04/23] pinctrl: equilibrium: Use temporary variable to hold pins Date: Wed, 29 Nov 2023 18:06:27 +0200 Message-ID: <20231129161459.1002323-5-andriy.shevchenko@linux.intel.com> X-Mailer: git-send-email 2.43.0.rc1.1.gbec44491f096 In-Reply-To: <20231129161459.1002323-1-andriy.shevchenko@linux.intel.com> References: <20231129161459.1002323-1-andriy.shevchenko@linux.intel.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-2.0 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_EF,RCVD_IN_DNSWL_BLOCKED, SPF_HELO_NONE,SPF_NONE,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (snail.vger.email [0.0.0.0]); Wed, 29 Nov 2023 08:28:52 -0800 (PST) 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 54755b583d3f..fd59cfdeefac 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; @@ -723,15 +723,14 @@ static int eqbr_build_groups(struct eqbr_pinctrl_drv_data *drvdata) } group.num_pins = err; 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; @@ -750,7 +749,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); -- 2.43.0.rc1.1.gbec44491f096