From nobody Thu Dec 18 18:01:15 2025 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 vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 3A372C2BB3F for ; Mon, 20 Nov 2023 22:28:45 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232637AbjKTW2q (ORCPT ); Mon, 20 Nov 2023 17:28:46 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:35418 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232539AbjKTW2n (ORCPT ); Mon, 20 Nov 2023 17:28:43 -0500 Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 87CCD97 for ; Mon, 20 Nov 2023 14:28:40 -0800 (PST) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 402C8C433CA; Mon, 20 Nov 2023 22:28:39 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1700519320; bh=lm7/gVjjO8J4rGGfH0O5RParZfMnIY0MkOc5Mwd5oTw=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=nJEQgwWOw+C7D8EhdvrVMZGCGeW51hRnSqEgzzkovWfmgQZMVejOyWW90TicHb9cR gSuTbi++TH6DeMRHW/0c5TzfwIwNeGFQI1O05cgt+tppgBXm5jGFvRdjVgl7CEQPSG j34REcfh1n/ag9wx3CAbciOYaMpeSuTe626Yp/Sb2pNWrJWSJBYXuFiwTDY4NGDxjh I/i0WB+FRhUzRsrM2jO4NFPJpU4YMC2hdETD5U/ddBm1Ld6E0JV0RSvHSttknPFIbs /rxAFZzE2O7NnLymcPwM08tbl4uXprn6CswuwexRlXliDejuQl35/tfySjABuERuhH KRpgUP7nAUk3A== From: Masahiro Yamada To: Linus Walleij , Bartosz Golaszewski , linux-gpio@vger.kernel.org Cc: linux-kernel@vger.kernel.org, Masahiro Yamada Subject: [PATCH 2/2] pinctrl: pinconf-generic: remove the special handling for no config case Date: Tue, 21 Nov 2023 07:28:32 +0900 Message-Id: <20231120222832.4063882-3-masahiroy@kernel.org> X-Mailer: git-send-email 2.40.1 In-Reply-To: <20231120222832.4063882-1-masahiroy@kernel.org> References: <20231120222832.4063882-1-masahiroy@kernel.org> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" To further simplify pinconf_generic_parse_dt_config(), eliminate the handling of the case where no configuration is found. When ncfg is zero, krealloc_array() will set ZERO_SIZE_PTR to *configs, which is a natural approach for managing a zero-size buffer. This should have no impact because none of the callers accesses 'configs' when ncfg is zero. Also, it is safe to pass ZERO_SIZE_PTR to kfree(). Signed-off-by: Masahiro Yamada --- drivers/pinctrl/pinconf-generic.c | 8 -------- 1 file changed, 8 deletions(-) diff --git a/drivers/pinctrl/pinconf-generic.c b/drivers/pinctrl/pinconf-ge= neric.c index ba4fe2466e78..252d69ee2b68 100644 --- a/drivers/pinctrl/pinconf-generic.c +++ b/drivers/pinctrl/pinconf-generic.c @@ -265,14 +265,6 @@ int pinconf_generic_parse_dt_config(struct device_node= *np, parse_dt_cfg(np, pctldev->desc->custom_params, pctldev->desc->num_custom_params, cfg, &ncfg); =20 - /* no configs found at all */ - if (ncfg =3D=3D 0) { - kfree(cfg); - *configs =3D NULL; - *nconfigs =3D 0; - return 0; - } - /* Now resize the array to store the real number of found properties. */ *configs =3D krealloc_array(cfg, ncfg, sizeof(unsigned long), GFP_KERNEL); if (!*configs) --=20 2.40.1