power: rk818-charger: fix cancel delayed work error because of not initialize
authorchenjh <chenjh@rock-chips.com>
Mon, 24 Apr 2017 02:26:25 +0000 (10:26 +0800)
committerchenjh <chenjh@rock-chips.com>
Mon, 24 Apr 2017 08:46:08 +0000 (16:46 +0800)
Change-Id: I2273c55f2ffbc5d09cf80bbfdf3030acada39eab
Signed-off-by: chenjh <chenjh@rock-chips.com>
drivers/power/rk818_charger.c

index 538952e61d54ee4d61a3f00957b6a020af1ab64b..c38d4828f4b5f6784381e0ae2bfe0e728b74ceae 100644 (file)
@@ -1283,9 +1283,13 @@ static void rk818_charger_shutdown(struct platform_device *pdev)
 {
        struct rk818_charger *cg = platform_get_drvdata(pdev);
 
-       cancel_delayed_work_sync(&cg->host_work);
+       /* type-c only */
+       if (cg->pdata->extcon) {
+               cancel_delayed_work_sync(&cg->host_work);
+               cancel_delayed_work_sync(&cg->discnt_work);
+       }
+
        cancel_delayed_work_sync(&cg->usb_work);
-       cancel_delayed_work_sync(&cg->discnt_work);
        cancel_delayed_work_sync(&cg->dc_work);
        cancel_delayed_work_sync(&cg->finish_sig_work);
        cancel_delayed_work_sync(&cg->irq_work);