Received: from mail.auroraos.dev (unknown [95.181.193.9]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id F220D770FE for ; Mon, 23 Feb 2026 20:15:03 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=95.181.193.9 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1771877707; cv=none; b=sYG7GzCLvYzlTavjU8glcZ4ckp645SKAu2CCvD8Kbai7NE7OfJ1OvwNDZFBtAQcMioN9/nGEpP7kc5YTsmcifs9HuuLprwLvkElyBi35HNWEs/ERtgOJi4qVJLaK0Ww3JTBLfDxE9bynIgn4KzLzxzQKBWPT3eODFm9HB7zI27w= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1771877707; c=relaxed/simple; bh=yNGZODFRqec923/8NYKV0Le5vNL4tv5DssG4ay/hylw=; h=From:To:CC:Subject:Date:Message-ID:MIME-Version:Content-Type; b=eaiXEyigB1FhBK4Vyme2ZVLqyh9Fq63W1zuxU1vyTBtFjReWebk8yQJEpZvmVpgMALQlH5LZwMlnpBsB2jvPOUd9ThhCFOjZkVHi+T22WvOMh4qFjT/K/Y+m0UeQjEnZhws3xIXis98JgJUfO8ifsKKE1+GnFNgOl2Op9Z8/zYM= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=auroraos.dev; spf=pass smtp.mailfrom=auroraos.dev; arc=none smtp.client-ip=95.181.193.9 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=auroraos.dev Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=auroraos.dev Received: from wasted (213.87.162.218) by exch16.corp.auroraos.dev (10.189.209.38) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.1847.3; Mon, 23 Feb 2026 23:15:01 +0300 From: Sergey Shtylyov To: Linus Walleij , Heiko Stuebner , , CC: Sergey Shtylyov , Subject: [PATCH] pinctrl: rockchip: drop NULL check in rockchip_pinctrl_parse_groups() Date: Mon, 23 Feb 2026 23:14:10 +0300 Message-ID: <20260223201412.20708-1-s.shtylyov@auroraos.dev> X-Mailer: git-send-email 2.53.0 Precedence: bulk X-Mailing-List: linux-gpio@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Content-Type: text/plain X-ClientProxiedBy: exch16.corp.auroraos.dev (10.189.209.38) To exch16.corp.auroraos.dev (10.189.209.38) In rockchip_pinctrl_parse_groups(), even if the "rockchip,pins" property is absent in the DT node it parses and so of_get_property() returns NULL, the phandle pointer is checked for NULL amidst the *for* loop after the list pointer (from which it's copied) being already advanced (and even dereferenced), so it can't be NULL anymore (unless we have a wraparound); thus the NULL check seems pointless, and when we drop it, the variable phandle itself becomes pretty useless -- let's get rid of it as well... Found by Linux Verification Center (linuxtesting.org) with the Svace static analysis tool. Signed-off-by: Sergey Shtylyov --- The patch is against the for-next branch of Linus W.'s linux-pinctrl.git repo. Here's the prior patch adding the NULL check where it really belonged but eventually ignored by Linus: https://lore.kernel.org/all/179c9e8c-8760-41e6-aad7-7a128df60984@omp.ru/ drivers/pinctrl/pinctrl-rockchip.c | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) diff --git a/drivers/pinctrl/pinctrl-rockchip.c b/drivers/pinctrl/pinctrl-rockchip.c index 816823403e97..8e195f951b9f 100644 --- a/drivers/pinctrl/pinctrl-rockchip.c +++ b/drivers/pinctrl/pinctrl-rockchip.c @@ -3863,7 +3863,6 @@ static int rockchip_pinctrl_parse_groups(struct device_node *np, return -ENOMEM; for (i = 0, j = 0; i < size; i += 4, j++) { - const __be32 *phandle; struct device_node *np_config; num = be32_to_cpu(*list++); @@ -3874,11 +3873,7 @@ static int rockchip_pinctrl_parse_groups(struct device_node *np, grp->pins[j] = bank->pin_base + be32_to_cpu(*list++); grp->data[j].func = be32_to_cpu(*list++); - phandle = list++; - if (!phandle) - return -EINVAL; - - np_config = of_find_node_by_phandle(be32_to_cpup(phandle)); + np_config = of_find_node_by_phandle(be32_to_cpup(list++)); ret = pinconf_generic_parse_dt_config(np_config, NULL, &grp->data[j].configs, &grp->data[j].nconfigs); of_node_put(np_config); -- 2.53.0