From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from smtpbgbr1.qq.com (smtpbgbr1.qq.com [54.207.19.206]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 4504727B32C; Wed, 20 May 2026 06:20:32 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=54.207.19.206 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1779258037; cv=none; b=U3nsn90FSJV8frYDV/RCw5FhTKps/NyU1eWZgnI/WcgKBI1Z9UjFX7d+D63ne4tLsYre+edsYr+rJr7mYu4JXj9GOsmGQpRALcBXjQ0n3Sh+Iy0ybX4s4GfeQm6UeD89PMZefluPjPjB8t6QU4d/nqvXu4wAsIQzrdLjEl1ZGTk= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1779258037; c=relaxed/simple; bh=a6fGxEH5BMyjsqkygp2GVPtB+r+Rb9RjEJSwUu9XC/g=; h=Mime-Version:Content-Type:Date:Message-Id:From:To:Cc:Subject: References:In-Reply-To; b=cpNPhr53TOKA+lqfbqoXNBskKOjVwJEhSFuQLun+NXXtGa/SZr+JkHhXsEm6xDXJ5tw+qD5zzroirpyQ2PhKA8SLKdbdBVs2QZRnnUyxDjmtnN1huYYxhi4LTt3MB2SH0zKZ3RkdATvMaxDXZkkOUmcAlGueyAa3TfeAGvFR2tc= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=linux.spacemit.com; spf=none smtp.mailfrom=linux.spacemit.com; dkim=pass (1024-bit key) header.d=linux.spacemit.com header.i=@linux.spacemit.com header.b=a1tTMgD6; arc=none smtp.client-ip=54.207.19.206 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=linux.spacemit.com Authentication-Results: smtp.subspace.kernel.org; spf=none smtp.mailfrom=linux.spacemit.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linux.spacemit.com header.i=@linux.spacemit.com header.b="a1tTMgD6" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux.spacemit.com; s=mxsw2412; t=1779257949; bh=hg5KK2xUCyB4FLoYLYP8YswpRDV5uXbEMujGSGVHGUA=; h=Mime-Version:Date:Message-Id:From:To:Subject; b=a1tTMgD6pTfjaggmgL42RSaT4YhHoLKTs0wYqvr0xnhj3x0tx+wMEpBACCqwxgPb+ l15qc8pd57Q+lIO4khmpkVi9gcRNSn/m3qPDycREwbzMb6OqIgNnpveqA8KMYeBWgw ch3qtxd1kJ2klhCiyixHE8cdoQmw6We6GPLSkUo4= X-QQ-mid: esmtpsz11t1779257947tda20d2be X-QQ-Originating-IP: 0xEUe3OK3WD/fOJoDhBLmRz2RyrACzSv+nYtYCmdgDQ= Received: from = ( [210.3.135.34]) by bizesmtp.qq.com (ESMTP) with id ; Wed, 20 May 2026 14:19:04 +0800 (CST) X-QQ-SSF: 0000000000000000000000000000000 X-QQ-GoodBg: 0 X-BIZMAIL-ID: 9958252558601639694 EX-QQ-RecipientCnt: 12 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: Mime-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset=UTF-8 Date: Wed, 20 May 2026 14:19:03 +0800 Message-Id: From: "Troy Mitchell" To: "Han Gao" , "Linus Walleij" , "Yixun Lan" , "Hendrik Hamerlinck" , "Anand Moon" , "Junhui Liu" , "Troy Mitchell" Cc: , , , , "Han Gao" Subject: Re: [PATCH] pinctrl: spacemit: fix NULL check in spacemit_pin_set_config X-Mailer: aerc 0.21.0-0-g5549850facc2 References: <20260519164007.122574-1-gaohan@iscas.ac.cn> In-Reply-To: <20260519164007.122574-1-gaohan@iscas.ac.cn> X-QQ-SENDSIZE: 520 Feedback-ID: esmtpsz:linux.spacemit.com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KpYSb2LChg4YPiyTLyHroLLDuO T99UBsz7HAn/5BBSKJ X-QQ-XMRINFO: M/715EihBoGS47X28/vv4NpnfpeBLnr4Qg== X-QQ-RECHKSPAM: 0 On Wed May 20, 2026 at 12:40 AM CST, Han Gao wrote: > spacemit_pin_set_config() looks up the per-pin descriptor with > spacemit_get_pin() then checks the wrong variable for failure: > > const struct spacemit_pin *spin =3D spacemit_get_pin(pctrl, pin); > ... > if (!pin) > return -EINVAL; > > reg =3D spacemit_pin_to_reg(pctrl, spin->pin); > > pin is an unsigned int pin id, where 0 (GPIO_0 / gmac0_rxdv on K3) is a > valid pin, so rejecting it here drops the PAD config write for the first > pin of every group. On K3 Pico-ITX the GMAC RGMII group lists pin 0 as > its first entry, so its drive-strength / bias configuration was silently > ignored. > > The intended guard is against spacemit_get_pin() returning NULL when the > pin id isn't in the SoC's pin table. Check spin instead, which both > restores PAD setup for pin 0 and prevents a NULL deref on spin->pin. > > Fixes: a83c29e1d145 ("pinctrl: spacemit: add support for SpacemiT K1 SoC"= ) > Signed-off-by: Han Gao Thanks. Reviewed-by: Troy Mitchell