From 947cc1408e785de475edda29be6d4602347586e1 Mon Sep 17 00:00:00 2001 From: Peng Fan Date: Mon, 11 Nov 2019 16:26:40 +0800 Subject: [PATCH] MLK-22941 ata: ahci_imx: fix error path When imx8_sata_enable failed, the clk/regulator needs to be disabled, otherwise there will be kernel dump as following: WARNING: CPU: 1 PID: 124 at drivers/regulator/core.c:2043 _regulator_put.part.27+0x34/0x158 Modules linked in: CPU: 1 PID: 124 Comm: kworker/1:11 Tainted: G W 5.4.0-rc5-03350-g718796b75472-dirty #1793 Hardware name: Freescale i.MX8QM MEK DOM0 (DT) 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 Reviewed-by: Dong Aisheng Acked-by: Richard Zhu Signed-off-by: Peng Fan --- drivers/ata/ahci_imx.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/ata/ahci_imx.c b/drivers/ata/ahci_imx.c index a7a796fbfe8d..a9f578fe22cf 100644 --- a/drivers/ata/ahci_imx.c +++ b/drivers/ata/ahci_imx.c @@ -945,7 +945,7 @@ static int imx_sata_enable(struct ahci_host_priv *hpriv) } else if (imxpriv->type == AHCI_IMX8QM) { ret = imx8_sata_enable(hpriv); if (ret) - return ret; + goto disable_clk; }