usb: phy: tahvo: fix error handling in tahvo_usb_probe()
authorAlexey Khoroshilov <khoroshilov@ispras.ru>
Fri, 20 Oct 2017 22:02:07 +0000 (01:02 +0300)
committerFelipe Balbi <felipe.balbi@linux.intel.com>
Tue, 24 Oct 2017 09:51:12 +0000 (12:51 +0300)
If devm_extcon_dev_allocate() fails, we should disable clk before return.

Found by Linux Driver Verification project (linuxtesting.org).

Signed-off-by: Alexey Khoroshilov <khoroshilov@ispras.ru>
Fixes: 860d2686fda7 ("usb: phy: tahvo: Use devm_extcon_dev_[allocate|register]() and replace deprecated API")
Signed-off-by: Felipe Balbi <felipe.balbi@linux.intel.com>
drivers/usb/phy/phy-tahvo.c

index 8babd318c0ed3230eb96bb1d303d06c4ebca8eaa..1ec00eae339a28319db21a07ae8f8f2cbea97a77 100644 (file)
@@ -368,7 +368,8 @@ static int tahvo_usb_probe(struct platform_device *pdev)
        tu->extcon = devm_extcon_dev_allocate(&pdev->dev, tahvo_cable);
        if (IS_ERR(tu->extcon)) {
                dev_err(&pdev->dev, "failed to allocate memory for extcon\n");
-               return -ENOMEM;
+               ret = PTR_ERR(tu->extcon);
+               goto err_disable_clk;
        }
 
        ret = devm_extcon_dev_register(&pdev->dev, tu->extcon);