linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH -next] phy: qcom-qmp: fix return value check in qcom_qmp_phy_create()
@ 2017-04-25  3:14 Wei Yongjun
  2017-04-25  4:21 ` Vivek Gautam
  0 siblings, 1 reply; 3+ messages in thread
From: Wei Yongjun @ 2017-04-25  3:14 UTC (permalink / raw)
  To: Kishon Vijay Abraham I, Vivek Gautam; +Cc: Wei Yongjun, linux-kernel

From: Wei Yongjun <weiyongjun1@huawei.com>

In case of error, the function of_iomap() returns NULL pointer
not ERR_PTR(). The IS_ERR() test in the return value check should
be replaced with NULL test.

Fixes: e78f3d15e115 ("phy: qcom-qmp: new qmp phy driver for qcom-chipsets")
Signed-off-by: Wei Yongjun <weiyongjun1@huawei.com>
---
 drivers/phy/phy-qcom-qmp.c | 12 ++++++------
 1 file changed, 6 insertions(+), 6 deletions(-)

diff --git a/drivers/phy/phy-qcom-qmp.c b/drivers/phy/phy-qcom-qmp.c
index 727e23b..a25c29d 100644
--- a/drivers/phy/phy-qcom-qmp.c
+++ b/drivers/phy/phy-qcom-qmp.c
@@ -983,16 +983,16 @@ int qcom_qmp_phy_create(struct device *dev, struct device_node *np, int id)
 	 * Resources are indexed as: tx -> 0; rx -> 1; pcs -> 2.
 	 */
 	qphy->tx = of_iomap(np, 0);
-	if (IS_ERR(qphy->tx))
-		return PTR_ERR(qphy->tx);
+	if (!qphy->tx)
+		return -ENOMEM;
 
 	qphy->rx = of_iomap(np, 1);
-	if (IS_ERR(qphy->rx))
-		return PTR_ERR(qphy->rx);
+	if (!qphy->rx)
+		return -ENOMEM;
 
 	qphy->pcs = of_iomap(np, 2);
-	if (IS_ERR(qphy->pcs))
-		return PTR_ERR(qphy->pcs);
+	if (!qphy->pcs)
+		return -ENOMEM;
 
 	/*
 	 * Get PHY's Pipe clock, if any. USB3 and PCIe are PIPE3

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

* Re: [PATCH -next] phy: qcom-qmp: fix return value check in qcom_qmp_phy_create()
  2017-04-25  3:14 [PATCH -next] phy: qcom-qmp: fix return value check in qcom_qmp_phy_create() Wei Yongjun
@ 2017-04-25  4:21 ` Vivek Gautam
  2017-05-17 10:54   ` Kishon Vijay Abraham I
  0 siblings, 1 reply; 3+ messages in thread
From: Vivek Gautam @ 2017-04-25  4:21 UTC (permalink / raw)
  To: Wei Yongjun, Kishon Vijay Abraham I; +Cc: Wei Yongjun, linux-kernel



On 04/25/2017 08:44 AM, Wei Yongjun wrote:
> From: Wei Yongjun <weiyongjun1@huawei.com>
>
> In case of error, the function of_iomap() returns NULL pointer
> not ERR_PTR(). The IS_ERR() test in the return value check should
> be replaced with NULL test.
>
> Fixes: e78f3d15e115 ("phy: qcom-qmp: new qmp phy driver for qcom-chipsets")
> Signed-off-by: Wei Yongjun <weiyongjun1@huawei.com>

Reviewed-by: Vivek Gautam <vivek.gautam@codeaurora.org>

> ---
>   drivers/phy/phy-qcom-qmp.c | 12 ++++++------
>   1 file changed, 6 insertions(+), 6 deletions(-)
>
> diff --git a/drivers/phy/phy-qcom-qmp.c b/drivers/phy/phy-qcom-qmp.c
> index 727e23b..a25c29d 100644
> --- a/drivers/phy/phy-qcom-qmp.c
> +++ b/drivers/phy/phy-qcom-qmp.c
> @@ -983,16 +983,16 @@ int qcom_qmp_phy_create(struct device *dev, struct device_node *np, int id)
>   	 * Resources are indexed as: tx -> 0; rx -> 1; pcs -> 2.
>   	 */
>   	qphy->tx = of_iomap(np, 0);
> -	if (IS_ERR(qphy->tx))
> -		return PTR_ERR(qphy->tx);
> +	if (!qphy->tx)
> +		return -ENOMEM;
>   
>   	qphy->rx = of_iomap(np, 1);
> -	if (IS_ERR(qphy->rx))
> -		return PTR_ERR(qphy->rx);
> +	if (!qphy->rx)
> +		return -ENOMEM;
>   
>   	qphy->pcs = of_iomap(np, 2);
> -	if (IS_ERR(qphy->pcs))
> -		return PTR_ERR(qphy->pcs);
> +	if (!qphy->pcs)
> +		return -ENOMEM;
>   
>   	/*
>   	 * Get PHY's Pipe clock, if any. USB3 and PCIe are PIPE3
>

-- 
The Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum,
a Linux Foundation Collaborative Project

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

* Re: [PATCH -next] phy: qcom-qmp: fix return value check in qcom_qmp_phy_create()
  2017-04-25  4:21 ` Vivek Gautam
@ 2017-05-17 10:54   ` Kishon Vijay Abraham I
  0 siblings, 0 replies; 3+ messages in thread
From: Kishon Vijay Abraham I @ 2017-05-17 10:54 UTC (permalink / raw)
  To: Vivek Gautam, Wei Yongjun; +Cc: Wei Yongjun, linux-kernel



On Tuesday 25 April 2017 09:51 AM, Vivek Gautam wrote:
> 
> 
> On 04/25/2017 08:44 AM, Wei Yongjun wrote:
>> From: Wei Yongjun <weiyongjun1@huawei.com>
>>
>> In case of error, the function of_iomap() returns NULL pointer
>> not ERR_PTR(). The IS_ERR() test in the return value check should
>> be replaced with NULL test.
>>
>> Fixes: e78f3d15e115 ("phy: qcom-qmp: new qmp phy driver for qcom-chipsets")
>> Signed-off-by: Wei Yongjun <weiyongjun1@huawei.com>
> 
> Reviewed-by: Vivek Gautam <vivek.gautam@codeaurora.org>

merged, thanks.

-Kishon
> 
>> ---
>>   drivers/phy/phy-qcom-qmp.c | 12 ++++++------
>>   1 file changed, 6 insertions(+), 6 deletions(-)
>>
>> diff --git a/drivers/phy/phy-qcom-qmp.c b/drivers/phy/phy-qcom-qmp.c
>> index 727e23b..a25c29d 100644
>> --- a/drivers/phy/phy-qcom-qmp.c
>> +++ b/drivers/phy/phy-qcom-qmp.c
>> @@ -983,16 +983,16 @@ int qcom_qmp_phy_create(struct device *dev, struct
>> device_node *np, int id)
>>        * Resources are indexed as: tx -> 0; rx -> 1; pcs -> 2.
>>        */
>>       qphy->tx = of_iomap(np, 0);
>> -    if (IS_ERR(qphy->tx))
>> -        return PTR_ERR(qphy->tx);
>> +    if (!qphy->tx)
>> +        return -ENOMEM;
>>         qphy->rx = of_iomap(np, 1);
>> -    if (IS_ERR(qphy->rx))
>> -        return PTR_ERR(qphy->rx);
>> +    if (!qphy->rx)
>> +        return -ENOMEM;
>>         qphy->pcs = of_iomap(np, 2);
>> -    if (IS_ERR(qphy->pcs))
>> -        return PTR_ERR(qphy->pcs);
>> +    if (!qphy->pcs)
>> +        return -ENOMEM;
>>         /*
>>        * Get PHY's Pipe clock, if any. USB3 and PCIe are PIPE3
>>
> 

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

end of thread, other threads:[~2017-05-17 10:55 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-04-25  3:14 [PATCH -next] phy: qcom-qmp: fix return value check in qcom_qmp_phy_create() Wei Yongjun
2017-04-25  4:21 ` Vivek Gautam
2017-05-17 10:54   ` Kishon Vijay Abraham I

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).