[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-Id: <20250413212518.2625540-1-chenyuan0y@gmail.com>
Date: Sun, 13 Apr 2025 16:25:18 -0500
From: Chenyuan Yang <chenyuan0y@...il.com>
To: vkoul@...nel.org,
kishon@...nel.org,
lumag@...nel.org,
quic_kriskura@...cinc.com,
manivannan.sadhasivam@...aro.org,
konrad.dybcio@....qualcomm.com,
quic_varada@...cinc.com,
quic_kbajaj@...cinc.com,
johan+linaro@...nel.org
Cc: linux-arm-msm@...r.kernel.org,
linux-phy@...ts.infradead.org,
linux-kernel@...r.kernel.org,
Chenyuan Yang <chenyuan0y@...il.com>
Subject: [PATCH] phy: qcom-qmp-usb: Fix an NULL vs IS_ERR() bug
In qmp_usb_iomap(), one branch returns the result of devm_ioremap(), which
can be NULL. Since IS_ERR() does not catch a NULL pointer,
add an explicit NULL check in qmp_usb_parse_dt_legacy() to prevent
potential dereference issues.
Signed-off-by: Chenyuan Yang <chenyuan0y@...il.com>
Fixes: 2a55ec4f0a04 ("phy: qcom-qmp-usb: merge driver data")
---
drivers/phy/qualcomm/phy-qcom-qmp-usb.c | 2 ++
1 file changed, 2 insertions(+)
diff --git a/drivers/phy/qualcomm/phy-qcom-qmp-usb.c b/drivers/phy/qualcomm/phy-qcom-qmp-usb.c
index 787721570457..8dab20b0c11c 100644
--- a/drivers/phy/qualcomm/phy-qcom-qmp-usb.c
+++ b/drivers/phy/qualcomm/phy-qcom-qmp-usb.c
@@ -2152,6 +2152,8 @@ static int qmp_usb_parse_dt_legacy(struct qmp_usb *qmp, struct device_node *np)
return PTR_ERR(qmp->rx);
qmp->pcs = qmp_usb_iomap(dev, np, 2, exclusive);
+ if (!qmp->pcs)
+ return -ENOMEM;
if (IS_ERR(qmp->pcs))
return PTR_ERR(qmp->pcs);
--
2.34.1
Powered by blists - more mailing lists