[PATCH v2] reset: starfive: jh71x0: Fix accessing the empty member on JH7110 SoC

Changhuang Liang posted 1 patch 2 months ago
There is a newer version of this series
drivers/reset/starfive/reset-starfive-jh71x0.c | 3 +++
1 file changed, 3 insertions(+)
[PATCH v2] reset: starfive: jh71x0: Fix accessing the empty member on JH7110 SoC
Posted by Changhuang Liang 2 months ago
data->asserted will be NULL on JH7110 SoC since commit 82327b127d41
("reset: starfive: Add StarFive JH7110 reset driver") was added. Add
the judgment condition to avoid errors when calling reset_control_status
on JH7110 SoC.

Signed-off-by: Changhuang Liang <changhuang.liang@starfivetech.com>
Acked-by: Hal Feng <hal.feng@starfivetech.com>
---

v2: Improve commit message

 drivers/reset/starfive/reset-starfive-jh71x0.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/drivers/reset/starfive/reset-starfive-jh71x0.c b/drivers/reset/starfive/reset-starfive-jh71x0.c
index 55bbbd2de52c..29ce3486752f 100644
--- a/drivers/reset/starfive/reset-starfive-jh71x0.c
+++ b/drivers/reset/starfive/reset-starfive-jh71x0.c
@@ -94,6 +94,9 @@ static int jh71x0_reset_status(struct reset_controller_dev *rcdev,
 	void __iomem *reg_status = data->status + offset * sizeof(u32);
 	u32 value = readl(reg_status);

+	if (!data->asserted)
+		return !(value & mask);
+
 	return !((value ^ data->asserted[offset]) & mask);
 }

--
2.25.1
Re: [PATCH v2] reset: starfive: jh71x0: Fix accessing the empty member on JH7110 SoC
Posted by Philipp Zabel 2 months ago
On Mi, 2024-09-25 at 02:59 -0700, Changhuang Liang wrote:
> data->asserted will be NULL on JH7110 SoC since commit 82327b127d41
> ("reset: starfive: Add StarFive JH7110 reset driver") was added. Add
> the judgment condition to avoid errors when calling reset_control_status
> on JH7110 SoC.

Please add a Fixes: line to make sure this is backported to all kernels
that contain commit 82327b127d41:

Fixes: 82327b127d41 ("reset: starfive: Add StarFive JH7110 reset driver")

> Signed-off-by: Changhuang Liang <changhuang.liang@starfivetech.com>
> Acked-by: Hal Feng <hal.feng@starfivetech.com>

With that,

Reviewed-by: Philipp Zabel <p.zabel@pengutronix.de>

regards
Philipp