[PATCH v2 2/3] usb: typec: intel_pmc_mux: Add missed error check for devm_ioremap_resource()
From: Andy Shevchenko
Date: Mon Jun 07 2021 - 16:50:15 EST
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")
Signed-off-by: Andy Shevchenko <andy.shevchenko@xxxxxxxxx>
Reviewed-by: Heikki Krogerus <heikki.krogerus@xxxxxxxxxxxxxxx>
---
v2: added Rb tag (Heikki)
drivers/usb/typec/mux/intel_pmc_mux.c | 5 +++++
1 file changed, 5 insertions(+)
diff --git a/drivers/usb/typec/mux/intel_pmc_mux.c b/drivers/usb/typec/mux/intel_pmc_mux.c
index 221aa1c0e77a..34e1662ad6ef 100644
--- a/drivers/usb/typec/mux/intel_pmc_mux.c
+++ b/drivers/usb/typec/mux/intel_pmc_mux.c
@@ -604,6 +604,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;
--
2.32.0