mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH -next 1/3] remoteproc: qcom: wcss: check return value after calling platform_get_resource_byname()
@ 2022-08-26  1:45 Yang Yingliang
  2022-08-26  1:45 ` [PATCH -next 2/3] remoteproc: qcom: wcss: Use devm_platform_ioremap_resource_byname() Yang Yingliang
                   ` (2 more replies)
  0 siblings, 3 replies; 7+ messages in thread
From: Yang Yingliang @ 2022-08-26  1:45 UTC (permalink / raw)
  To: linux-kernel, linux-remoteproc; +Cc: agross, bjorn.andersson

If platform_get_resource_byname() fails, 'res' will be set to null pointer,
it will cause null-ptr-deref when it used in devm_ioremap(), so we need check
the return value.

Fixes: 0af65b9b915e ("remoteproc: qcom: wcss: Add non pas wcss Q6 support for QCS404")
Signed-off-by: Yang Yingliang <yangyingliang@huawei.com>
---
 drivers/remoteproc/qcom_q6v5_wcss.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/drivers/remoteproc/qcom_q6v5_wcss.c b/drivers/remoteproc/qcom_q6v5_wcss.c
index bb0947f7770e..017ee225dc32 100644
--- a/drivers/remoteproc/qcom_q6v5_wcss.c
+++ b/drivers/remoteproc/qcom_q6v5_wcss.c
@@ -827,6 +827,8 @@ static int q6v5_wcss_init_mmio(struct q6v5_wcss *wcss,
 	int ret;
 
 	res = platform_get_resource_byname(pdev, IORESOURCE_MEM, "qdsp6");
+	if (!res)
+		return -EINVAL;
 	wcss->reg_base = devm_ioremap(&pdev->dev, res->start,
 				      resource_size(res));
 	if (!wcss->reg_base)
-- 
2.25.1


^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2022-10-09  8:38 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-08-26  1:45 [PATCH -next 1/3] remoteproc: qcom: wcss: check return value after calling platform_get_resource_byname() Yang Yingliang
2022-08-26  1:45 ` [PATCH -next 2/3] remoteproc: qcom: wcss: Use devm_platform_ioremap_resource_byname() Yang Yingliang
2022-08-26  5:36   ` Mukesh Ojha
2022-08-26  1:45 ` [PATCH -next 3/3] remoteproc: qcom: wcss: Use dev_err_probe() helper in q6v5_wcss_init_clock() Yang Yingliang
2022-08-26  5:44   ` Mukesh Ojha
2022-08-26  5:33 ` [PATCH -next 1/3] remoteproc: qcom: wcss: check return value after calling platform_get_resource_byname() Mukesh Ojha
2022-10-09  8:38   ` Yang Yingliang

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®