Linux USB
 help / color / mirror / Atom feed
* [PATCH] usb: typec: qcom: fix return value check in qcom_pmic_typec_probe()
@ 2023-07-25 12:53 Yang Yingliang
  2023-07-25 13:17 ` Konrad Dybcio
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: Yang Yingliang @ 2023-07-25 12:53 UTC (permalink / raw)
  To: linux-usb, linux-arm-msm
  Cc: bryan.odonoghue, linux, heikki.krogerus, agross, andersson,
	konrad.dybcio, gregkh, caleb.connolly

device_get_named_child_node() returns NULL, if it fails, replace
IS_ERR() with NULL pointer check.

Fixes: a4422ff22142 ("usb: typec: qcom: Add Qualcomm PMIC Type-C driver")
Signed-off-by: Yang Yingliang <yangyingliang@huawei.com>
---
 drivers/usb/typec/tcpm/qcom/qcom_pmic_typec.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/usb/typec/tcpm/qcom/qcom_pmic_typec.c b/drivers/usb/typec/tcpm/qcom/qcom_pmic_typec.c
index a905160dd860..9b467a346114 100644
--- a/drivers/usb/typec/tcpm/qcom/qcom_pmic_typec.c
+++ b/drivers/usb/typec/tcpm/qcom/qcom_pmic_typec.c
@@ -209,8 +209,8 @@ static int qcom_pmic_typec_probe(struct platform_device *pdev)
 	platform_set_drvdata(pdev, tcpm);
 
 	tcpm->tcpc.fwnode = device_get_named_child_node(tcpm->dev, "connector");
-	if (IS_ERR(tcpm->tcpc.fwnode))
-		return PTR_ERR(tcpm->tcpc.fwnode);
+	if (!tcpm->tcpc.fwnode)
+		return -EINVAL;
 
 	tcpm->tcpm_port = tcpm_register_port(tcpm->dev, &tcpm->tcpc);
 	if (IS_ERR(tcpm->tcpm_port)) {
-- 
2.25.1


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

* Re: [PATCH] usb: typec: qcom: fix return value check in qcom_pmic_typec_probe()
  2023-07-25 12:53 [PATCH] usb: typec: qcom: fix return value check in qcom_pmic_typec_probe() Yang Yingliang
@ 2023-07-25 13:17 ` Konrad Dybcio
  2023-07-25 14:18 ` Guenter Roeck
  2023-07-25 14:35 ` Bryan O'Donoghue
  2 siblings, 0 replies; 4+ messages in thread
From: Konrad Dybcio @ 2023-07-25 13:17 UTC (permalink / raw)
  To: Yang Yingliang, linux-usb, linux-arm-msm
  Cc: bryan.odonoghue, linux, heikki.krogerus, agross, andersson,
	gregkh, caleb.connolly

On 25.07.2023 14:53, Yang Yingliang wrote:
> device_get_named_child_node() returns NULL, if it fails, replace
> IS_ERR() with NULL pointer check.
> 
> Fixes: a4422ff22142 ("usb: typec: qcom: Add Qualcomm PMIC Type-C driver")
> Signed-off-by: Yang Yingliang <yangyingliang@huawei.com>
> ---
Acked-by: Konrad Dybcio <konrad.dybcio@linaro.org>

Konrad

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

* Re: [PATCH] usb: typec: qcom: fix return value check in qcom_pmic_typec_probe()
  2023-07-25 12:53 [PATCH] usb: typec: qcom: fix return value check in qcom_pmic_typec_probe() Yang Yingliang
  2023-07-25 13:17 ` Konrad Dybcio
@ 2023-07-25 14:18 ` Guenter Roeck
  2023-07-25 14:35 ` Bryan O'Donoghue
  2 siblings, 0 replies; 4+ messages in thread
From: Guenter Roeck @ 2023-07-25 14:18 UTC (permalink / raw)
  To: Yang Yingliang, linux-usb, linux-arm-msm
  Cc: bryan.odonoghue, heikki.krogerus, agross, andersson,
	konrad.dybcio, gregkh, caleb.connolly

On 7/25/23 05:53, Yang Yingliang wrote:
> device_get_named_child_node() returns NULL, if it fails, replace
> IS_ERR() with NULL pointer check.
> 
> Fixes: a4422ff22142 ("usb: typec: qcom: Add Qualcomm PMIC Type-C driver")
> Signed-off-by: Yang Yingliang <yangyingliang@huawei.com>

Reviewed-by: Guenter Roeck <linux@roeck-us.net>

> ---
>   drivers/usb/typec/tcpm/qcom/qcom_pmic_typec.c | 4 ++--
>   1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/usb/typec/tcpm/qcom/qcom_pmic_typec.c b/drivers/usb/typec/tcpm/qcom/qcom_pmic_typec.c
> index a905160dd860..9b467a346114 100644
> --- a/drivers/usb/typec/tcpm/qcom/qcom_pmic_typec.c
> +++ b/drivers/usb/typec/tcpm/qcom/qcom_pmic_typec.c
> @@ -209,8 +209,8 @@ static int qcom_pmic_typec_probe(struct platform_device *pdev)
>   	platform_set_drvdata(pdev, tcpm);
>   
>   	tcpm->tcpc.fwnode = device_get_named_child_node(tcpm->dev, "connector");
> -	if (IS_ERR(tcpm->tcpc.fwnode))
> -		return PTR_ERR(tcpm->tcpc.fwnode);
> +	if (!tcpm->tcpc.fwnode)
> +		return -EINVAL;
>   
>   	tcpm->tcpm_port = tcpm_register_port(tcpm->dev, &tcpm->tcpc);
>   	if (IS_ERR(tcpm->tcpm_port)) {


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

* Re: [PATCH] usb: typec: qcom: fix return value check in qcom_pmic_typec_probe()
  2023-07-25 12:53 [PATCH] usb: typec: qcom: fix return value check in qcom_pmic_typec_probe() Yang Yingliang
  2023-07-25 13:17 ` Konrad Dybcio
  2023-07-25 14:18 ` Guenter Roeck
@ 2023-07-25 14:35 ` Bryan O'Donoghue
  2 siblings, 0 replies; 4+ messages in thread
From: Bryan O'Donoghue @ 2023-07-25 14:35 UTC (permalink / raw)
  To: Yang Yingliang, linux-usb, linux-arm-msm
  Cc: linux, heikki.krogerus, agross, andersson, konrad.dybcio, gregkh,
	caleb.connolly

On 25/07/2023 13:53, Yang Yingliang wrote:
> device_get_named_child_node() returns NULL, if it fails, replace
> IS_ERR() with NULL pointer check.
> 
> Fixes: a4422ff22142 ("usb: typec: qcom: Add Qualcomm PMIC Type-C driver")
> Signed-off-by: Yang Yingliang <yangyingliang@huawei.com>
> ---
>   drivers/usb/typec/tcpm/qcom/qcom_pmic_typec.c | 4 ++--
>   1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/usb/typec/tcpm/qcom/qcom_pmic_typec.c b/drivers/usb/typec/tcpm/qcom/qcom_pmic_typec.c
> index a905160dd860..9b467a346114 100644
> --- a/drivers/usb/typec/tcpm/qcom/qcom_pmic_typec.c
> +++ b/drivers/usb/typec/tcpm/qcom/qcom_pmic_typec.c
> @@ -209,8 +209,8 @@ static int qcom_pmic_typec_probe(struct platform_device *pdev)
>   	platform_set_drvdata(pdev, tcpm);
>   
>   	tcpm->tcpc.fwnode = device_get_named_child_node(tcpm->dev, "connector");
> -	if (IS_ERR(tcpm->tcpc.fwnode))
> -		return PTR_ERR(tcpm->tcpc.fwnode);
> +	if (!tcpm->tcpc.fwnode)
> +		return -EINVAL;
>   
>   	tcpm->tcpm_port = tcpm_register_port(tcpm->dev, &tcpm->tcpc);
>   	if (IS_ERR(tcpm->tcpm_port)) {

Acked-by: Bryan O'Donoghue <bryan.odonoghue@linaro.org>

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

end of thread, other threads:[~2023-07-25 14:36 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-07-25 12:53 [PATCH] usb: typec: qcom: fix return value check in qcom_pmic_typec_probe() Yang Yingliang
2023-07-25 13:17 ` Konrad Dybcio
2023-07-25 14:18 ` Guenter Roeck
2023-07-25 14:35 ` Bryan O'Donoghue

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox