[PATCH 4/5] clk: imx: Fix rewriting of hws by resets in generic blk-ctl driver

Marek Vasut marex at denx.de
Sat Oct 3 18:45:54 EDT 2020


Do not call imx_blk_ctl_register_one_clock() if the hw type is a reset,
only call it for clock, otherwise hws[hw->id] content might be corrupted
or NULL if the above is also called for hw type reset.

Signed-off-by: Marek Vasut <marex at denx.de>
Cc: Abel Vesa <abel.vesa at nxp.com>
Cc: Dong Aisheng <aisheng.dong at nxp.com>
Cc: Fabio Estevam <festevam at gmail.com>
Cc: Guido Günther <agx at sigxcpu.org>
Cc: Lucas Stach <l.stach at pengutronix.de>
Cc: NXP Linux Team <linux-imx at nxp.com>
Cc: Shawn Guo <shawnguo at kernel.org>
---
 drivers/clk/imx/clk-blk-ctl.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/drivers/clk/imx/clk-blk-ctl.c b/drivers/clk/imx/clk-blk-ctl.c
index 1a6f1eb49f69..8dc59868984f 100644
--- a/drivers/clk/imx/clk-blk-ctl.c
+++ b/drivers/clk/imx/clk-blk-ctl.c
@@ -221,6 +221,9 @@ static int imx_blk_ctl_register_clock_controller(struct device *dev)
 	for (i = 0; i < dev_data->hws_num; i++) {
 		struct imx_blk_ctl_hw *hw = &dev_data->hws[i];
 
+		if (hw->type == BLK_CTL_RESET)
+			continue;
+
 		hws[hw->id] = imx_blk_ctl_register_one_clock(dev, hw);
 		WARN(IS_ERR(hws[hw->id]), "failed to register clock %d", hw->id);
 	}
-- 
2.28.0




More information about the linux-arm-kernel mailing list