diff mbox series

[v1,2/3] usb: typec: intel_pmc_mux: Add missed error check for devm_ioremap_resource()

Message ID 20210606200911.32076-2-andy.shevchenko@gmail.com
State Superseded
Headers show
Series [v1,1/3] usb: typec: intel_pmc_mux: Put fwnode in error case during ->probe() | expand

Commit Message

Andy Shevchenko June 6, 2021, 8:09 p.m. UTC
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")
Cc: Heikki Krogerus <heikki.krogerus@linux.intel.com>
Signed-off-by: Andy Shevchenko <andy.shevchenko@gmail.com>
---
 drivers/usb/typec/mux/intel_pmc_mux.c | 5 +++++
 1 file changed, 5 insertions(+)

Comments

Heikki Krogerus June 7, 2021, 9:25 a.m. UTC | #1
On Sun, Jun 06, 2021 at 11:09:10PM +0300, Andy Shevchenko wrote:
> 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")

> Cc: Heikki Krogerus <heikki.krogerus@linux.intel.com>

> Signed-off-by: Andy Shevchenko <andy.shevchenko@gmail.com>


Reviewed-by: Heikki Krogerus <heikki.krogerus@linux.intel.com>


> ---

>  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 134325444e6a..de40276cc18b 100644

> --- a/drivers/usb/typec/mux/intel_pmc_mux.c

> +++ b/drivers/usb/typec/mux/intel_pmc_mux.c

> @@ -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;

> -- 

> 2.31.1


-- 
heikki
diff mbox series

Patch

diff --git a/drivers/usb/typec/mux/intel_pmc_mux.c b/drivers/usb/typec/mux/intel_pmc_mux.c
index 134325444e6a..de40276cc18b 100644
--- a/drivers/usb/typec/mux/intel_pmc_mux.c
+++ b/drivers/usb/typec/mux/intel_pmc_mux.c
@@ -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;