usb: typec: intel_pmc_mux: Add missed error check for devm_ioremap_resource()
authorAndy Shevchenko <andy.shevchenko@gmail.com>
Mon, 7 Jun 2021 20:50:06 +0000 (23:50 +0300)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Wed, 9 Jun 2021 08:56:11 +0000 (10:56 +0200)
devm_ioremap_resource() can return an error, add missed check for it.

Fixes: 43d596e32276 ("usb: typec: intel_pmc_mux: Check the port status before connect")
Reviewed-by: Heikki Krogerus <heikki.krogerus@linux.intel.com>
Signed-off-by: Andy Shevchenko <andy.shevchenko@gmail.com>
Cc: stable <stable@vger.kernel.org>
Link: https://lore.kernel.org/r/20210607205007.71458-2-andy.shevchenko@gmail.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/usb/typec/mux/intel_pmc_mux.c

index 96d8c5a..31b1b3b 100644 (file)
@@ -586,6 +586,11 @@ static int pmc_usb_probe_iom(struct pmc_usb *pmc)
                return -ENOMEM;
        }
 
+       if (IS_ERR(pmc->iom_base)) {
+               put_device(&adev->dev);
+               return PTR_ERR(pmc->iom_base);
+       }
+
        pmc->iom_adev = adev;
 
        return 0;