Skip to content

Commit a9f17d0

Browse files
tititiou36vinodkoul
authored andcommitted
phy: ti: tusb1210: Fix an error handling path in tusb1210_probe()
tusb1210_probe_charger_detect() must be undone by a corresponding tusb1210_remove_charger_detect() in the error handling path, as already done in the remove function. Fixes: 48969a5 ("phy: ti: tusb1210: Add charger detection") Signed-off-by: Christophe JAILLET <[email protected]> Reviewed-by: Hans de Goede <[email protected]> Link: https://lore.kernel.org/r/07c4926c42243cedb3b6067a241bb486fdda01b5.1648991162.git.christophe.jaillet@wanadoo.fr Signed-off-by: Vinod Koul <[email protected]>
1 parent 5c8402c commit a9f17d0

File tree

1 file changed

+8
-2
lines changed

1 file changed

+8
-2
lines changed

drivers/phy/ti/phy-tusb1210.c

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -537,12 +537,18 @@ static int tusb1210_probe(struct ulpi *ulpi)
537537
tusb1210_probe_charger_detect(tusb);
538538

539539
tusb->phy = ulpi_phy_create(ulpi, &phy_ops);
540-
if (IS_ERR(tusb->phy))
541-
return PTR_ERR(tusb->phy);
540+
if (IS_ERR(tusb->phy)) {
541+
ret = PTR_ERR(tusb->phy);
542+
goto err_remove_charger;
543+
}
542544

543545
phy_set_drvdata(tusb->phy, tusb);
544546
ulpi_set_drvdata(ulpi, tusb);
545547
return 0;
548+
549+
err_remove_charger:
550+
tusb1210_remove_charger_detect(tusb);
551+
return ret;
546552
}
547553

548554
static void tusb1210_remove(struct ulpi *ulpi)

0 commit comments

Comments
 (0)