linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] usb: chipidea: msm: Handle error codes
@ 2021-12-03  8:01 Jiasheng Jiang
  2021-12-04 13:02 ` Peter Chen
  0 siblings, 1 reply; 2+ messages in thread
From: Jiasheng Jiang @ 2021-12-03  8:01 UTC (permalink / raw)
  To: peter.chen, gregkh, p.zabel; +Cc: linux-usb, linux-kernel, Jiasheng Jiang

The return value of of_get_next_available_child() and
of_device_is_compatible() is not always 0.
To catch the exception in case of the failure.

Fixes: 47654a162081 ("usb: chipidea: msm: Restore wrapper settings after reset")
Signed-off-by: Jiasheng Jiang <jiasheng@iscas.ac.cn>
---
 drivers/usb/chipidea/ci_hdrc_msm.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/drivers/usb/chipidea/ci_hdrc_msm.c b/drivers/usb/chipidea/ci_hdrc_msm.c
index 46105457e1ca..13218f0a2bed 100644
--- a/drivers/usb/chipidea/ci_hdrc_msm.c
+++ b/drivers/usb/chipidea/ci_hdrc_msm.c
@@ -246,6 +246,8 @@ static int ci_hdrc_msm_probe(struct platform_device *pdev)
 	if (ulpi_node) {
 		phy_node = of_get_next_available_child(ulpi_node, NULL);
 		ci->hsic = of_device_is_compatible(phy_node, "qcom,usb-hsic-phy");
+		if (!phy_node || !ci->hsic)
+			goto err_mux;
 		of_node_put(phy_node);
 	}
 	of_node_put(ulpi_node);
-- 
2.25.1


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH] usb: chipidea: msm: Handle error codes
  2021-12-03  8:01 [PATCH] usb: chipidea: msm: Handle error codes Jiasheng Jiang
@ 2021-12-04 13:02 ` Peter Chen
  0 siblings, 0 replies; 2+ messages in thread
From: Peter Chen @ 2021-12-04 13:02 UTC (permalink / raw)
  To: Jiasheng Jiang; +Cc: gregkh, p.zabel, linux-usb, linux-kernel

On 21-12-03 16:01:06, Jiasheng Jiang wrote:
> The return value of of_get_next_available_child() and
> of_device_is_compatible() is not always 0.
> To catch the exception in case of the failure.
> 
> Fixes: 47654a162081 ("usb: chipidea: msm: Restore wrapper settings after reset")
> Signed-off-by: Jiasheng Jiang <jiasheng@iscas.ac.cn>
> ---
>  drivers/usb/chipidea/ci_hdrc_msm.c | 2 ++
>  1 file changed, 2 insertions(+)
> 
> diff --git a/drivers/usb/chipidea/ci_hdrc_msm.c b/drivers/usb/chipidea/ci_hdrc_msm.c
> index 46105457e1ca..13218f0a2bed 100644
> --- a/drivers/usb/chipidea/ci_hdrc_msm.c
> +++ b/drivers/usb/chipidea/ci_hdrc_msm.c
> @@ -246,6 +246,8 @@ static int ci_hdrc_msm_probe(struct platform_device *pdev)
>  	if (ulpi_node) {
>  		phy_node = of_get_next_available_child(ulpi_node, NULL);
>  		ci->hsic = of_device_is_compatible(phy_node, "qcom,usb-hsic-phy");
> +		if (!phy_node || !ci->hsic)
> +			goto err_mux;

I afraid I could not understand your change with your patch description,
no matter phy_node is NULL or ci->hsic is NULL, the code should be OK,
right?

>  		of_node_put(phy_node);
>  	}
>  	of_node_put(ulpi_node);
> -- 
> 2.25.1
> 

-- 

Thanks,
Peter Chen


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2021-12-04 13:02 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-12-03  8:01 [PATCH] usb: chipidea: msm: Handle error codes Jiasheng Jiang
2021-12-04 13:02 ` Peter Chen

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).