From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=115.124.28.53 ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none; t=1796116073; b=SKASDHWFYwpx8h4gbaPznpseFa40qUrXX+7Q0NqKAD2o2bwb5vmkiffpNH3hGD1+CjXY xBp7Q/MHuEnCWZnPcUoesM1+d+oFAK14C5FK0CuSR2HMRqRhPey2JqDZ8HDtvOIQRUH3f 1OAHDXnnQpu+RIBNNt9gJY73kIbisbwL3+iVmzvXHdTdcwBxMq4yBdneXsV8wyHqrtcOJ Fg6biMlAA1Pt+0rCbHJCjj+4akMnFFnLi3X38O8jTLZTdsi+GM4yFzinTxY8bXkktOcwb yZp9C9/9yxStxp/12/MXJm1BoDOqXnxsVu6smwQEy/Ai4Ta6SgOptWxKESWVLMQDgnw== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796116073; h=DMARC-Filter:X-Alimail-AntiSpam:Received:From:To:Cc:Subject:Date: Message-Id:X-Mailer:In-Reply-To:References:MIME-Version: Content-Transfer-Encoding; bh=cwyq1YWoInl47h8Zj1hn7WOrq3pbY6gohxk+30GybL4=; b=Ym2c4i59yaNUTUaSR/YylNEUxXwVLBRf2pR/8jtcl4tI7nThNFitL1EzJoXfiittqk4j et9LeJNs++k0tDfpdYDpKJgue6OtyBhsnewCd+0Op5F9mcKtyo/7fzm8M1CvoR1V2RULL lJ2Or7qsqrL/yGqRQDBm3/rACVtUbRtImn2w2rOEKUCT/n52GvXRaoyEKZwCApjyVnHs2 aV6nJFd0Vi9MJhvJe88Ce1GGw92iFYr3BLVQ9aveZia1BlNMKGDc4FNohLqPnetfEtteP VQi7Nj9Gt1WjV8pJhAqvDg2YYVagt6+cWZgvdtx1r6BBtfmmzGQHCd2m/hovxlgLAhQ== ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=none header.from=kaihong.com; spf=pass smtp.mailfrom=kaihong.com; arc=none smtp.remote-ip=115.124.28.53 Received: from out28-53.mail.aliyun.com (out28-53.mail.aliyun.com [115.124.28.53]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (prime256v1) server-digest SHA256) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id E1E7F606A33A; Tue, 1 Dec 2026 09:07:51 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.2 smtp.subspace.kernel.org E1E7F606A33A Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=kaihong.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=kaihong.com X-Alimail-AntiSpam:AC=CONTINUE;BC=0.148943|-1;CH=green;DM=|CONTINUE|false|;DS=CONTINUE|ham_alarm|0.00221578-0.000296395-0.997488;FP=14793181350578554533|0|0|0|0|-1|-1|-1;HT=maildocker-contentspam033045139068;MF=wangxiaolei01@kaihong.com;NM=1;PH=DS;RN=13;RT=13;SR=0;TI=SMTPD_---.kE5Vdku_1796116061; Received: from nj-vm-261.pxvirt.local(mailfrom:wangxiaolei01@kaihong.com fp:SMTPD_---.kE5Vdku_1796116061 cluster:ay29) by smtp.aliyun-inc.com; Tue, 01 Dec 2026 17:07:43 +0800 From: Xiaolei Wang To: linusw@kernel.org, florian.fainelli@broadcom.com, bcm-kernel-feedback-list@broadcom.com, daniel@dragonzap.com, wangxiaolei01@kaihong.com, iivanov@suse.de, andrea.porta@suse.com, phil@raspberrypi.com Cc: linux-gpio@vger.kernel.org, linux-rpi-kernel@lists.infradead.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, stable@vger.kernel.org Subject: [PATCH v2 2/2] pinctrl: rp1: use pinctrl_utils_free_map() for map cleanup Date: Tue, 1 Dec 2026 09:07:17 +0000 Message-Id: <20261201090717.2470936-3-wangxiaolei01@kaihong.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20261201090717.2470936-1-wangxiaolei01@kaihong.com> References: <20261201090717.2470936-1-wangxiaolei01@kaihong.com> X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Post: List-Help: List-Subscribe: List-Unsubscribe: List-Owner: Precedence: list MIME-Version: 1.0 Content-Transfer-Encoding: 8bit The rp1 driver open-codes a dt_free_map callback that frees the config arrays of pinctrl maps and the map array itself. This duplicates pinctrl_utils_free_map(), which the pinctrl core already provides for exactly this purpose. The local copy only handles CONFIGS_PIN maps. Because the driver can delegate map creation to the generic pinconf DT parser, CONFIGS_GROUP maps may also be produced, and their config arrays would be leaked by the open-coded version. The core helper handles both types, so using it removes the duplicate code and closes that leak at the same time. Fixes: e3ce7b897388 ("pinctrl: rp1: Implement RaspberryPi RP1 pinmux/pinconf support") Cc: stable@vger.kernel.org Signed-off-by: Xiaolei Wang --- drivers/pinctrl/pinctrl-rp1.c | 16 ++-------------- 1 file changed, 2 insertions(+), 14 deletions(-) diff --git a/drivers/pinctrl/pinctrl-rp1.c b/drivers/pinctrl/pinctrl-rp1.c index 99566a25ecb4..bf2c300eef29 100644 --- a/drivers/pinctrl/pinctrl-rp1.c +++ b/drivers/pinctrl/pinctrl-rp1.c @@ -1089,18 +1089,6 @@ static void rp1_pctl_pin_dbg_show(struct pinctrl_dev *pctldev, irq, irq_type_names[pin->irq_type]); } -static void rp1_pctl_dt_free_map(struct pinctrl_dev *pctldev, - struct pinctrl_map *maps, unsigned int num_maps) -{ - int i; - - for (i = 0; i < num_maps; i++) - if (maps[i].type == PIN_MAP_TYPE_CONFIGS_PIN) - kfree(maps[i].data.configs.configs); - - kfree(maps); -} - static int rp1_pctl_legacy_map_func(struct rp1_pinctrl *pc, struct device_node *np, u32 pin, u32 fnum, struct pinctrl_map *maps, @@ -1286,7 +1274,7 @@ static int rp1_pctl_dt_node_to_map(struct pinctrl_dev *pctldev, return 0; out: - rp1_pctl_dt_free_map(pctldev, maps, reserved_maps); + pinctrl_utils_free_map(pctldev, maps, reserved_maps); return err; } @@ -1296,7 +1284,7 @@ static const struct pinctrl_ops rp1_pctl_ops = { .get_group_pins = rp1_pctl_get_group_pins, .pin_dbg_show = rp1_pctl_pin_dbg_show, .dt_node_to_map = rp1_pctl_dt_node_to_map, - .dt_free_map = rp1_pctl_dt_free_map, + .dt_free_map = pinctrl_utils_free_map, }; static int rp1_pmx_free(struct pinctrl_dev *pctldev, unsigned int offset) -- 2.34.1