From nobody Mon Oct 6 12:02:03 2025 Received: from mx0b-0031df01.pphosted.com (mx0b-0031df01.pphosted.com [205.220.180.131]) (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 98A50289344 for ; Tue, 22 Jul 2025 05:44:57 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=205.220.180.131 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1753163100; cv=none; b=d356usF1POzKylEz7drKTdhvcagjmmakr89Jvf1ps+MFIbIhTtlo445jUGd22nA1gwo5C/3Ir2uwIDniQmzIZNX/yQIrdr46fTmN0uaLR916N52n9c+SkVWZm2MWoPqc28IVKsbG4AXx6xq0y6sQZVNUmxhvAAJggsN34dAC8ms= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1753163100; c=relaxed/simple; bh=ukjz107venpREw1AXh4B8olSE8I9TNZM92z3x+eADHg=; h=From:To:Cc:Subject:Date:Message-Id:MIME-Version; b=U1gyarz74BNPcfA2ayP3ipd5EgEG0nTtJDzgRx0et9zchsC83A9B+UoPWV0RdHLennklrg+/iBHNblSnjUxxGxqzGtPciFvjNbh/hHVkVC+5EFRPWpJjfeqCoFPc1CYQdINKdDw7apJOD7TWGW6XY8TwSyOvsEbP1V+MT44PLm0= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=oss.qualcomm.com; spf=pass smtp.mailfrom=oss.qualcomm.com; dkim=pass (2048-bit key) header.d=qualcomm.com header.i=@qualcomm.com header.b=AfqZew4R; arc=none smtp.client-ip=205.220.180.131 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=oss.qualcomm.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=oss.qualcomm.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=qualcomm.com header.i=@qualcomm.com header.b="AfqZew4R" Received: from pps.filterd (m0279870.ppops.net [127.0.0.1]) by mx0a-0031df01.pphosted.com (8.18.1.2/8.18.1.2) with ESMTP id 56M15u4e016274 for ; Tue, 22 Jul 2025 05:44:56 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=qualcomm.com; h= cc:content-transfer-encoding:date:from:message-id:mime-version :subject:to; s=qcppdkim1; bh=75DfiJpF1MttMuOkBOXm8Q+i0oMIyLyaAAI 5qQMiwVg=; b=AfqZew4R8muh4CKK8rI/aLL9YpauWYXGwTy0jrzj9HZSdDVDGpN kvmnfyPPHsr0uSJnDXZNeAeEYsydQgMGeEjB8rKThZp8zmSywNFb1XNpe6EXb++G ph/NWR04SR7Hp9/Bevm9w8X96bCUrlbWS0nis6bRcPTVGTND35w6ecQw8ZxCY9tK k4PBit6ogsMDGz1vgM4IjkgQsMRS5TAS45ppsv6xjyslIzAmEbO11BF4UgEI3E5b 81TBug5vcvvJ90j019jZbndD0Gw4U3moVjSGkeUApgq+2OnRAo/4NB+uAppTgKUL iaO4yzhN2DrESObcL0HQJxZ9q5GfPESLJ5Q== Received: from mail-pl1-f197.google.com (mail-pl1-f197.google.com [209.85.214.197]) by mx0a-0031df01.pphosted.com (PPS) with ESMTPS id 48048s095h-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128 verify=NOT) for ; Tue, 22 Jul 2025 05:44:56 +0000 (GMT) Received: by mail-pl1-f197.google.com with SMTP id d9443c01a7336-2363bb41664so40735625ad.0 for ; Mon, 21 Jul 2025 22:44:55 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1753163095; x=1753767895; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=75DfiJpF1MttMuOkBOXm8Q+i0oMIyLyaAAI5q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0E= X-Received: by 2002:a17:902:ebcb:b0:237:e753:1808 with SMTP id d9443c01a7336-23f8accd820mr31458675ad.20.1753163094787; Mon, 21 Jul 2025 22:44:54 -0700 (PDT) X-Google-Smtp-Source: AGHT+IFjnBKOTKbEfvmKSJ25MWepQGV65OWl3NjJ9lnM4agFmO6tGJ8XkNxJ1NO5Wil99RX2LWYPxA== X-Received: by 2002:a17:902:ebcb:b0:237:e753:1808 with SMTP id d9443c01a7336-23f8accd820mr31458375ad.20.1753163094335; Mon, 21 Jul 2025 22:44:54 -0700 (PDT) Received: from yuanjiey.qualcomm.com (i-global254.qualcomm.com. [199.106.103.254]) by smtp.gmail.com with ESMTPSA id d9443c01a7336-23e3b6b4d65sm67494375ad.109.2025.07.21.22.44.51 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 21 Jul 2025 22:44:53 -0700 (PDT) From: yuanjie yang To: andersson@kernel.org, linus.walleij@linaro.org, linux-arm-msm@vger.kernel.org, linux-gpio@vger.kernel.org, linux-kernel@vger.kernel.org Cc: kernel@oss.qualcomm.com, quic_tingweiz@quicinc.com, quic_yuanjiey@quicinc.com Subject: [PATCH] pinctrl: qcom: Fix logic error when TLMM reg-names property is missing Date: Tue, 22 Jul 2025 13:44:46 +0800 Message-Id: <20250722054446.3432-1-yuanjie.yang@oss.qualcomm.com> X-Mailer: git-send-email 2.34.1 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 X-Proofpoint-Spam-Details-Enc: AW1haW4tMjUwNzIyMDA0NSBTYWx0ZWRfX47P1KdMhHYgL bjmokwot/nxQqNn/1EsLZcNrXy4fo1lj+Wmv9mschQcz7WyW5XLyf+gQWT/AtWuSt5J13lH3Kvr QPaHJIOiUw0onaCCBL0WW4c5PeA8o307B8FPCYxxO1Cf0PDX9bB+CGFme5iR8k3pbycARWb5erY cWlyg9GY6HztU/RNn85bkPsLailw0uUOGxdKRkfiEsfC35+nQq/rOBCVi6/TVOEXLpee2T1yNDQ LKLJxolPvYTNSkGgAeT5cli8G4PvVfAcZ7xf5ECwtvWAlTkx0Aqxhpe2DuGUF9qz7eyOC7hkm8r DwLZf3tPPrf5mnNMsJ8PDAX5CrRif24g6X6AtaZfFpR8ep8QHG/LEwKKx+S4WoCKRh7qZB17MnS zv6E6qUhtZSY4SXHG2kAcz3gfhrbNREuqykn30YZcOEuJUMfts5F7ETlFHlg1NGSiUTpRrWB X-Proofpoint-ORIG-GUID: 5ylisJL7eiRTpcjFeKaO-qh3WrlXS6At X-Proofpoint-GUID: 5ylisJL7eiRTpcjFeKaO-qh3WrlXS6At X-Authority-Analysis: v=2.4 cv=OPUn3TaB c=1 sm=1 tr=0 ts=687f2558 cx=c_pps a=cmESyDAEBpBGqyK7t0alAg==:117 a=JYp8KDb2vCoCEuGobkYCKw==:17 a=Wb1JkmetP80A:10 a=EUspDBNiAAAA:8 a=WDoE7Cz0S_A2IT9AzmkA:9 a=1OuFwYUASf3TG4hYMiVC:22 X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.293,Aquarius:18.0.1099,Hydra:6.1.9,FMLib:17.12.80.40 definitions=2025-07-22_01,2025-07-21_02,2025-03-28_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 adultscore=0 clxscore=1011 mlxlogscore=999 lowpriorityscore=0 suspectscore=0 spamscore=0 mlxscore=0 bulkscore=0 priorityscore=1501 phishscore=0 malwarescore=0 impostorscore=0 classifier=spam authscore=0 authtc=n/a authcc= route=outbound adjust=0 reason=mlx scancount=1 engine=8.19.0-2505280000 definitions=main-2507220045 Content-Type: text/plain; charset="utf-8" From: Yuanjie Yang Some Qualcomm platforms, such as sm8750.dtsi, define a single TLMM region without the reg-names property. This is a valid and expected configuration. However, the current code incorrectly treats the absence of reg-names as an error, resulting in unintended behavior. Refactoring the logic to handle both cases correctly: If only the gpio parameter is provided, default to TLMM region 0. If both gpio and name are provided, compare the reg-names entries in the TLMM node with the given name to select the appropriate region. This ensures proper handling of platforms with either single or multiple TLMM regions. Fixes: 56ffb63749f4 ("pinctrl: qcom: add multi TLMM region option parameter= ") Signed-off-by: Yuanjie Yang --- drivers/pinctrl/qcom/tlmm-test.c | 32 ++++++++++++++++---------------- 1 file changed, 16 insertions(+), 16 deletions(-) diff --git a/drivers/pinctrl/qcom/tlmm-test.c b/drivers/pinctrl/qcom/tlmm-t= est.c index 7d7fff538755..6de8cf23f9f0 100644 --- a/drivers/pinctrl/qcom/tlmm-test.c +++ b/drivers/pinctrl/qcom/tlmm-test.c @@ -581,25 +581,25 @@ static int tlmm_reg_base(struct device_node *tlmm, st= ruct resource *res) int ret; int i; =20 - count =3D of_property_count_strings(tlmm, "reg-names"); - if (count <=3D 0) { - pr_err("failed to find tlmm reg name\n"); - return count; - } - - reg_names =3D kcalloc(count, sizeof(char *), GFP_KERNEL); - if (!reg_names) - return -ENOMEM; - - ret =3D of_property_read_string_array(tlmm, "reg-names", reg_names, count= ); - if (ret !=3D count) { - kfree(reg_names); - return -EINVAL; - } - if (!strcmp(tlmm_reg_name, "default_region")) { ret =3D of_address_to_resource(tlmm, 0, res); } else { + count =3D of_property_count_strings(tlmm, "reg-names"); + if (count <=3D 0) { + pr_err("failed to find tlmm reg name\n"); + return -EINVAL; + } + + reg_names =3D kcalloc(count, sizeof(char *), GFP_KERNEL); + if (!reg_names) + return -ENOMEM; + + ret =3D of_property_read_string_array(tlmm, "reg-names", reg_names, coun= t); + if (ret !=3D count) { + kfree(reg_names); + return -EINVAL; + } + for (i =3D 0; i < count; i++) { if (!strcmp(reg_names[i], tlmm_reg_name)) { ret =3D of_address_to_resource(tlmm, i, res); base-commit: d086c886ceb9f59dea6c3a9dae7eb89e780a20c9 --=20 2.34.1