linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Jiasheng Jiang <jiasheng@iscas.ac.cn>
To: peter.chen@kernel.org, gregkh@linuxfoundation.org,
	p.zabel@pengutronix.de
Cc: linux-usb@vger.kernel.org, linux-kernel@vger.kernel.org,
	Jiasheng Jiang <jiasheng@iscas.ac.cn>
Subject: [PATCH] usb: chipidea: msm: Handle error codes
Date: Fri,  3 Dec 2021 16:01:06 +0800	[thread overview]
Message-ID: <20211203080106.1559983-1-jiasheng@iscas.ac.cn> (raw)

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


             reply	other threads:[~2021-12-03  8:01 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-12-03  8:01 Jiasheng Jiang [this message]
2021-12-04 13:02 ` [PATCH] usb: chipidea: msm: Handle error codes Peter Chen

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20211203080106.1559983-1-jiasheng@iscas.ac.cn \
    --to=jiasheng@iscas.ac.cn \
    --cc=gregkh@linuxfoundation.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-usb@vger.kernel.org \
    --cc=p.zabel@pengutronix.de \
    --cc=peter.chen@kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).