[PATCH] ahci: imx: i.MX8QM: fix error handling
From: Peng Fan
Date: Tue Nov 12 2019 - 00:17:14 EST
From: Peng Fan <peng.fan@xxxxxxx>
When imx8_sata_enable failed, need to jump to path disable_clk.
Otherwise there will be kernel dump as following.
Workqueue: events deferred_probe_work_func
pstate: 60000005 (nZCv daif -PAN -UAO)
pc : _regulator_put.part.27+0x34/0x158
lr : _regulator_put.part.27+0x2c/0x158
sp : ffff80001286bb00
x29: ffff80001286bb00 x28: 0000000000000000
x27: 0000000000000000 x26: ffff8000100fddf0
x25: 0000000000000000 x24: 000000000000001b
x23: ffff80001286bbd8 x22: ffff0008ea007600
x21: ffff0008ea0104f0 x20: ffff0008ea007e00
x19: ffff8000120753e8 x18: 0000000000000010
x17: 00000000eefd8a54 x16: 00000000deadbeef
x15: ffffffffffffffff x14: ffff800011f198c8
x13: 0000000000000000 x12: 0000000000000001
x11: 0000000000000000 x10: 0000000000000990
x9 : ffff80001286b870 x8 : ffff0008eb99c0f0
x7 : ffff0008eb99b880 x6 : ffff0008eb99b7c0
x5 : 00000000000001df x4 : 0000000000001adb
x3 : ffff8008de089000 x2 : a4c383a3cc862400
x1 : 0000000000000000 x0 : 0000000000000001
Call trace:
_regulator_put.part.27+0x34/0x158
regulator_put+0x34/0x48
ahci_platform_put_resources+0x64/0xd0
release_nodes+0x1b0/0x220
devres_release_all+0x34/0x50
really_probe+0x1b8/0x308
driver_probe_device+0x54/0xe8
__device_attach_driver+0x80/0xb8
bus_for_each_drv+0x78/0xc8
__device_attach+0xd4/0x130
device_initial_probe+0x10/0x18
bus_probe_device+0x90/0x98
deferred_probe_work_func+0x64/0x98
process_one_work+0x1e0/0x358
worker_thread+0x208/0x488
kthread+0x118/0x120
ret_from_fork+0x10/0x18
Signed-off-by: Peng Fan <peng.fan@xxxxxxx>
---
drivers/ata/ahci_imx.c | 2 ++
1 file changed, 2 insertions(+)
diff --git a/drivers/ata/ahci_imx.c b/drivers/ata/ahci_imx.c
index bfc617cc8ac5..1d6a5ef78259 100644
--- a/drivers/ata/ahci_imx.c
+++ b/drivers/ata/ahci_imx.c
@@ -692,6 +692,8 @@ static int imx_sata_enable(struct ahci_host_priv *hpriv)
}
} else if (imxpriv->type == AHCI_IMX8QM) {
ret = imx8_sata_enable(hpriv);
+ if (ret)
+ goto disable_clk;
}
usleep_range(1000, 2000);
--
2.16.4