* [PATCH v2] phy: mapphone-mdm6600: cancel delayed work on probe error
@ 2026-12-01 4:19 Cong Nguyen
0 siblings, 0 replies; only message in thread
From: Cong Nguyen @ 2026-12-01 4:19 UTC (permalink / raw)
To: Vinod Koul
Cc: Neil Armstrong, Manivannan Sadhasivam, Tony Lindgren, linux-phy,
linux-kernel
phy_mdm6600_probe() queues bootup_work before it can fail, and the
status IRQ and runtime resume queue status_work and modem_wake_work.
If a later step fails, nothing cancels them, and they can run after the
devres-managed ddata is freed.
Use devm_delayed_work_autocancel() for the three works. It is set up
before the devm IRQs, so devres frees the IRQs first and cancels the
works after, and the IRQ handlers cannot queue them again.
Fixes: 2ad2af081622 ("phy: mapphone-mdm6600: Improve phy related runtime PM calls")
Signed-off-by: Cong Nguyen <congnt264@gmail.com>
---
Changes in v2:
- Use devm_delayed_work_autocancel() instead of cancelling by hand in the
probe error path. The devm IRQs can still queue status_work after a
manual cancel (Sashiko review of v1).
drivers/phy/motorola/phy-mapphone-mdm6600.c | 20 ++++++++++++++++----
1 file changed, 16 insertions(+), 4 deletions(-)
diff --git a/drivers/phy/motorola/phy-mapphone-mdm6600.c b/drivers/phy/motorola/phy-mapphone-mdm6600.c
index ff364a990187..cbe05f8984e8 100644
--- a/drivers/phy/motorola/phy-mapphone-mdm6600.c
+++ b/drivers/phy/motorola/phy-mapphone-mdm6600.c
@@ -5,6 +5,7 @@
*/
#include <linux/delay.h>
+#include <linux/devm-helpers.h>
#include <linux/err.h>
#include <linux/io.h>
#include <linux/interrupt.h>
@@ -561,10 +562,21 @@ static int phy_mdm6600_probe(struct platform_device *pdev)
if (!ddata)
return -ENOMEM;
- INIT_DELAYED_WORK(&ddata->bootup_work,
- phy_mdm6600_deferred_power_on);
- INIT_DELAYED_WORK(&ddata->status_work, phy_mdm6600_status);
- INIT_DELAYED_WORK(&ddata->modem_wake_work, phy_mdm6600_modem_wake);
+ error = devm_delayed_work_autocancel(&pdev->dev, &ddata->bootup_work,
+ phy_mdm6600_deferred_power_on);
+ if (error)
+ return error;
+
+ error = devm_delayed_work_autocancel(&pdev->dev, &ddata->status_work,
+ phy_mdm6600_status);
+ if (error)
+ return error;
+
+ error = devm_delayed_work_autocancel(&pdev->dev, &ddata->modem_wake_work,
+ phy_mdm6600_modem_wake);
+ if (error)
+ return error;
+
init_completion(&ddata->ack);
ddata->dev = &pdev->dev;
--
2.25.1
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2026-12-01 4:19 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-12-01 4:19 [PATCH v2] phy: mapphone-mdm6600: cancel delayed work on probe error Cong Nguyen
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®