All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] ath10k: fix the status check and wrong return
@ 2020-08-14 14:48 ` Tang Bin
  0 siblings, 0 replies; 12+ messages in thread
From: Tang Bin @ 2020-08-14 14:48 UTC (permalink / raw)
  To: kvalo, davem
  Cc: ath10k, linux-wireless, netdev, linux-kernel, Tang Bin, Zhang Shengju

In the function ath10k_ahb_clock_init(), devm_clk_get() doesn't
return NULL. Thus use IS_ERR() and PTR_ERR() to validate
the returned value instead of IS_ERR_OR_NULL().

Signed-off-by: Zhang Shengju <zhangshengju@cmss.chinamobile.com>
Signed-off-by: Tang Bin <tangbin@cmss.chinamobile.com>
---
 drivers/net/wireless/ath/ath10k/ahb.c | 12 ++++++------
 1 file changed, 6 insertions(+), 6 deletions(-)

diff --git a/drivers/net/wireless/ath/ath10k/ahb.c b/drivers/net/wireless/ath/ath10k/ahb.c
index ed87bc00f..ea669af6a 100644
--- a/drivers/net/wireless/ath/ath10k/ahb.c
+++ b/drivers/net/wireless/ath/ath10k/ahb.c
@@ -87,24 +87,24 @@ static int ath10k_ahb_clock_init(struct ath10k *ar)
 	dev = &ar_ahb->pdev->dev;
 
 	ar_ahb->cmd_clk = devm_clk_get(dev, "wifi_wcss_cmd");
-	if (IS_ERR_OR_NULL(ar_ahb->cmd_clk)) {
+	if (IS_ERR(ar_ahb->cmd_clk)) {
 		ath10k_err(ar, "failed to get cmd clk: %ld\n",
 			   PTR_ERR(ar_ahb->cmd_clk));
-		return ar_ahb->cmd_clk ? PTR_ERR(ar_ahb->cmd_clk) : -ENODEV;
+		return PTR_ERR(ar_ahb->cmd_clk);
 	}
 
 	ar_ahb->ref_clk = devm_clk_get(dev, "wifi_wcss_ref");
-	if (IS_ERR_OR_NULL(ar_ahb->ref_clk)) {
+	if (IS_ERR(ar_ahb->ref_clk)) {
 		ath10k_err(ar, "failed to get ref clk: %ld\n",
 			   PTR_ERR(ar_ahb->ref_clk));
-		return ar_ahb->ref_clk ? PTR_ERR(ar_ahb->ref_clk) : -ENODEV;
+		return PTR_ERR(ar_ahb->ref_clk);
 	}
 
 	ar_ahb->rtc_clk = devm_clk_get(dev, "wifi_wcss_rtc");
-	if (IS_ERR_OR_NULL(ar_ahb->rtc_clk)) {
+	if (IS_ERR(ar_ahb->rtc_clk)) {
 		ath10k_err(ar, "failed to get rtc clk: %ld\n",
 			   PTR_ERR(ar_ahb->rtc_clk));
-		return ar_ahb->rtc_clk ? PTR_ERR(ar_ahb->rtc_clk) : -ENODEV;
+		return PTR_ERR(ar_ahb->rtc_clk);
 	}
 
 	return 0;
-- 
2.20.1.windows.1




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

* [PATCH] ath10k: fix the status check and wrong return
@ 2020-08-14 14:48 ` Tang Bin
  0 siblings, 0 replies; 12+ messages in thread
From: Tang Bin @ 2020-08-14 14:48 UTC (permalink / raw)
  To: kvalo, davem
  Cc: Tang Bin, netdev, linux-wireless, linux-kernel, ath10k, Zhang Shengju

In the function ath10k_ahb_clock_init(), devm_clk_get() doesn't
return NULL. Thus use IS_ERR() and PTR_ERR() to validate
the returned value instead of IS_ERR_OR_NULL().

Signed-off-by: Zhang Shengju <zhangshengju@cmss.chinamobile.com>
Signed-off-by: Tang Bin <tangbin@cmss.chinamobile.com>
---
 drivers/net/wireless/ath/ath10k/ahb.c | 12 ++++++------
 1 file changed, 6 insertions(+), 6 deletions(-)

diff --git a/drivers/net/wireless/ath/ath10k/ahb.c b/drivers/net/wireless/ath/ath10k/ahb.c
index ed87bc00f..ea669af6a 100644
--- a/drivers/net/wireless/ath/ath10k/ahb.c
+++ b/drivers/net/wireless/ath/ath10k/ahb.c
@@ -87,24 +87,24 @@ static int ath10k_ahb_clock_init(struct ath10k *ar)
 	dev = &ar_ahb->pdev->dev;
 
 	ar_ahb->cmd_clk = devm_clk_get(dev, "wifi_wcss_cmd");
-	if (IS_ERR_OR_NULL(ar_ahb->cmd_clk)) {
+	if (IS_ERR(ar_ahb->cmd_clk)) {
 		ath10k_err(ar, "failed to get cmd clk: %ld\n",
 			   PTR_ERR(ar_ahb->cmd_clk));
-		return ar_ahb->cmd_clk ? PTR_ERR(ar_ahb->cmd_clk) : -ENODEV;
+		return PTR_ERR(ar_ahb->cmd_clk);
 	}
 
 	ar_ahb->ref_clk = devm_clk_get(dev, "wifi_wcss_ref");
-	if (IS_ERR_OR_NULL(ar_ahb->ref_clk)) {
+	if (IS_ERR(ar_ahb->ref_clk)) {
 		ath10k_err(ar, "failed to get ref clk: %ld\n",
 			   PTR_ERR(ar_ahb->ref_clk));
-		return ar_ahb->ref_clk ? PTR_ERR(ar_ahb->ref_clk) : -ENODEV;
+		return PTR_ERR(ar_ahb->ref_clk);
 	}
 
 	ar_ahb->rtc_clk = devm_clk_get(dev, "wifi_wcss_rtc");
-	if (IS_ERR_OR_NULL(ar_ahb->rtc_clk)) {
+	if (IS_ERR(ar_ahb->rtc_clk)) {
 		ath10k_err(ar, "failed to get rtc clk: %ld\n",
 			   PTR_ERR(ar_ahb->rtc_clk));
-		return ar_ahb->rtc_clk ? PTR_ERR(ar_ahb->rtc_clk) : -ENODEV;
+		return PTR_ERR(ar_ahb->rtc_clk);
 	}
 
 	return 0;
-- 
2.20.1.windows.1




_______________________________________________
ath10k mailing list
ath10k@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/ath10k

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

* Re: [PATCH] ath10k: fix the status check and wrong return
  2020-08-14 14:48 ` Tang Bin
@ 2020-08-14 16:40   ` Tom Psyborg
  -1 siblings, 0 replies; 12+ messages in thread
From: Tom Psyborg @ 2020-08-14 16:40 UTC (permalink / raw)
  To: Tang Bin
  Cc: kvalo, davem, ath10k, linux-wireless, netdev, linux-kernel,
	Zhang Shengju

On 14/08/2020, Tang Bin <tangbin@cmss.chinamobile.com> wrote:
> In the function ath10k_ahb_clock_init(), devm_clk_get() doesn't
> return NULL. Thus use IS_ERR() and PTR_ERR() to validate
> the returned value instead of IS_ERR_OR_NULL().
>
> Signed-off-by: Zhang Shengju <zhangshengju@cmss.chinamobile.com>
> Signed-off-by: Tang Bin <tangbin@cmss.chinamobile.com>
> ---
>  drivers/net/wireless/ath/ath10k/ahb.c | 12 ++++++------
>  1 file changed, 6 insertions(+), 6 deletions(-)
>
> diff --git a/drivers/net/wireless/ath/ath10k/ahb.c
> b/drivers/net/wireless/ath/ath10k/ahb.c
> index ed87bc00f..ea669af6a 100644
> --- a/drivers/net/wireless/ath/ath10k/ahb.c
> +++ b/drivers/net/wireless/ath/ath10k/ahb.c
> @@ -87,24 +87,24 @@ static int ath10k_ahb_clock_init(struct ath10k *ar)
>  	dev = &ar_ahb->pdev->dev;
>
>  	ar_ahb->cmd_clk = devm_clk_get(dev, "wifi_wcss_cmd");
> -	if (IS_ERR_OR_NULL(ar_ahb->cmd_clk)) {
> +	if (IS_ERR(ar_ahb->cmd_clk)) {
>  		ath10k_err(ar, "failed to get cmd clk: %ld\n",
>  			   PTR_ERR(ar_ahb->cmd_clk));
> -		return ar_ahb->cmd_clk ? PTR_ERR(ar_ahb->cmd_clk) : -ENODEV;
> +		return PTR_ERR(ar_ahb->cmd_clk);
>  	}
>
>  	ar_ahb->ref_clk = devm_clk_get(dev, "wifi_wcss_ref");
> -	if (IS_ERR_OR_NULL(ar_ahb->ref_clk)) {
> +	if (IS_ERR(ar_ahb->ref_clk)) {
>  		ath10k_err(ar, "failed to get ref clk: %ld\n",
>  			   PTR_ERR(ar_ahb->ref_clk));
> -		return ar_ahb->ref_clk ? PTR_ERR(ar_ahb->ref_clk) : -ENODEV;
> +		return PTR_ERR(ar_ahb->ref_clk);
>  	}
>
>  	ar_ahb->rtc_clk = devm_clk_get(dev, "wifi_wcss_rtc");
> -	if (IS_ERR_OR_NULL(ar_ahb->rtc_clk)) {
> +	if (IS_ERR(ar_ahb->rtc_clk)) {
>  		ath10k_err(ar, "failed to get rtc clk: %ld\n",
>  			   PTR_ERR(ar_ahb->rtc_clk));
> -		return ar_ahb->rtc_clk ? PTR_ERR(ar_ahb->rtc_clk) : -ENODEV;
> +		return PTR_ERR(ar_ahb->rtc_clk);
>  	}
>
>  	return 0;
> --
> 2.20.1.windows.1
>
>
>
>

Hi

You should've include which HW/FW combination you tested this on

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

* Re: [PATCH] ath10k: fix the status check and wrong return
@ 2020-08-14 16:40   ` Tom Psyborg
  0 siblings, 0 replies; 12+ messages in thread
From: Tom Psyborg @ 2020-08-14 16:40 UTC (permalink / raw)
  To: Tang Bin
  Cc: netdev, linux-wireless, linux-kernel, ath10k, Zhang Shengju,
	davem, kvalo

On 14/08/2020, Tang Bin <tangbin@cmss.chinamobile.com> wrote:
> In the function ath10k_ahb_clock_init(), devm_clk_get() doesn't
> return NULL. Thus use IS_ERR() and PTR_ERR() to validate
> the returned value instead of IS_ERR_OR_NULL().
>
> Signed-off-by: Zhang Shengju <zhangshengju@cmss.chinamobile.com>
> Signed-off-by: Tang Bin <tangbin@cmss.chinamobile.com>
> ---
>  drivers/net/wireless/ath/ath10k/ahb.c | 12 ++++++------
>  1 file changed, 6 insertions(+), 6 deletions(-)
>
> diff --git a/drivers/net/wireless/ath/ath10k/ahb.c
> b/drivers/net/wireless/ath/ath10k/ahb.c
> index ed87bc00f..ea669af6a 100644
> --- a/drivers/net/wireless/ath/ath10k/ahb.c
> +++ b/drivers/net/wireless/ath/ath10k/ahb.c
> @@ -87,24 +87,24 @@ static int ath10k_ahb_clock_init(struct ath10k *ar)
>  	dev = &ar_ahb->pdev->dev;
>
>  	ar_ahb->cmd_clk = devm_clk_get(dev, "wifi_wcss_cmd");
> -	if (IS_ERR_OR_NULL(ar_ahb->cmd_clk)) {
> +	if (IS_ERR(ar_ahb->cmd_clk)) {
>  		ath10k_err(ar, "failed to get cmd clk: %ld\n",
>  			   PTR_ERR(ar_ahb->cmd_clk));
> -		return ar_ahb->cmd_clk ? PTR_ERR(ar_ahb->cmd_clk) : -ENODEV;
> +		return PTR_ERR(ar_ahb->cmd_clk);
>  	}
>
>  	ar_ahb->ref_clk = devm_clk_get(dev, "wifi_wcss_ref");
> -	if (IS_ERR_OR_NULL(ar_ahb->ref_clk)) {
> +	if (IS_ERR(ar_ahb->ref_clk)) {
>  		ath10k_err(ar, "failed to get ref clk: %ld\n",
>  			   PTR_ERR(ar_ahb->ref_clk));
> -		return ar_ahb->ref_clk ? PTR_ERR(ar_ahb->ref_clk) : -ENODEV;
> +		return PTR_ERR(ar_ahb->ref_clk);
>  	}
>
>  	ar_ahb->rtc_clk = devm_clk_get(dev, "wifi_wcss_rtc");
> -	if (IS_ERR_OR_NULL(ar_ahb->rtc_clk)) {
> +	if (IS_ERR(ar_ahb->rtc_clk)) {
>  		ath10k_err(ar, "failed to get rtc clk: %ld\n",
>  			   PTR_ERR(ar_ahb->rtc_clk));
> -		return ar_ahb->rtc_clk ? PTR_ERR(ar_ahb->rtc_clk) : -ENODEV;
> +		return PTR_ERR(ar_ahb->rtc_clk);
>  	}
>
>  	return 0;
> --
> 2.20.1.windows.1
>
>
>
>

Hi

You should've include which HW/FW combination you tested this on

_______________________________________________
ath10k mailing list
ath10k@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/ath10k

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

* Re: [PATCH] ath10k: fix the status check and wrong return
  2020-08-14 14:48 ` Tang Bin
@ 2020-08-17 14:26   ` Kalle Valo
  -1 siblings, 0 replies; 12+ messages in thread
From: Kalle Valo @ 2020-08-17 14:26 UTC (permalink / raw)
  To: Tang Bin
  Cc: davem, netdev, linux-wireless, linux-kernel, ath10k, Zhang Shengju

Tang Bin <tangbin@cmss.chinamobile.com> writes:

> In the function ath10k_ahb_clock_init(), devm_clk_get() doesn't
> return NULL. Thus use IS_ERR() and PTR_ERR() to validate
> the returned value instead of IS_ERR_OR_NULL().

Why? What's the benefit of this patch? Or what harm does
IS_ERR_OR_NULL() create?

> Signed-off-by: Zhang Shengju <zhangshengju@cmss.chinamobile.com>
> Signed-off-by: Tang Bin <tangbin@cmss.chinamobile.com>
> ---
>  drivers/net/wireless/ath/ath10k/ahb.c | 12 ++++++------
>  1 file changed, 6 insertions(+), 6 deletions(-)
>
> diff --git a/drivers/net/wireless/ath/ath10k/ahb.c b/drivers/net/wireless/ath/ath10k/ahb.c
> index ed87bc00f..ea669af6a 100644
> --- a/drivers/net/wireless/ath/ath10k/ahb.c
> +++ b/drivers/net/wireless/ath/ath10k/ahb.c
> @@ -87,24 +87,24 @@ static int ath10k_ahb_clock_init(struct ath10k *ar)
>  	dev = &ar_ahb->pdev->dev;
>  
>  	ar_ahb->cmd_clk = devm_clk_get(dev, "wifi_wcss_cmd");
> -	if (IS_ERR_OR_NULL(ar_ahb->cmd_clk)) {
> +	if (IS_ERR(ar_ahb->cmd_clk)) {
>  		ath10k_err(ar, "failed to get cmd clk: %ld\n",
>  			   PTR_ERR(ar_ahb->cmd_clk));
> -		return ar_ahb->cmd_clk ? PTR_ERR(ar_ahb->cmd_clk) : -ENODEV;
> +		return PTR_ERR(ar_ahb->cmd_clk);
>  	}

devm_clk_get() can return NULL if CONFIG_HAVE_CLK is disabled:

static inline struct clk *devm_clk_get(struct device *dev, const char *id)
{
	return NULL;
}

-- 
https://wireless.wiki.kernel.org/en/developers/documentation/submittingpatches

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

* Re: [PATCH] ath10k: fix the status check and wrong return
@ 2020-08-17 14:26   ` Kalle Valo
  0 siblings, 0 replies; 12+ messages in thread
From: Kalle Valo @ 2020-08-17 14:26 UTC (permalink / raw)
  To: Tang Bin
  Cc: netdev, linux-wireless, linux-kernel, ath10k, davem, Zhang Shengju

Tang Bin <tangbin@cmss.chinamobile.com> writes:

> In the function ath10k_ahb_clock_init(), devm_clk_get() doesn't
> return NULL. Thus use IS_ERR() and PTR_ERR() to validate
> the returned value instead of IS_ERR_OR_NULL().

Why? What's the benefit of this patch? Or what harm does
IS_ERR_OR_NULL() create?

> Signed-off-by: Zhang Shengju <zhangshengju@cmss.chinamobile.com>
> Signed-off-by: Tang Bin <tangbin@cmss.chinamobile.com>
> ---
>  drivers/net/wireless/ath/ath10k/ahb.c | 12 ++++++------
>  1 file changed, 6 insertions(+), 6 deletions(-)
>
> diff --git a/drivers/net/wireless/ath/ath10k/ahb.c b/drivers/net/wireless/ath/ath10k/ahb.c
> index ed87bc00f..ea669af6a 100644
> --- a/drivers/net/wireless/ath/ath10k/ahb.c
> +++ b/drivers/net/wireless/ath/ath10k/ahb.c
> @@ -87,24 +87,24 @@ static int ath10k_ahb_clock_init(struct ath10k *ar)
>  	dev = &ar_ahb->pdev->dev;
>  
>  	ar_ahb->cmd_clk = devm_clk_get(dev, "wifi_wcss_cmd");
> -	if (IS_ERR_OR_NULL(ar_ahb->cmd_clk)) {
> +	if (IS_ERR(ar_ahb->cmd_clk)) {
>  		ath10k_err(ar, "failed to get cmd clk: %ld\n",
>  			   PTR_ERR(ar_ahb->cmd_clk));
> -		return ar_ahb->cmd_clk ? PTR_ERR(ar_ahb->cmd_clk) : -ENODEV;
> +		return PTR_ERR(ar_ahb->cmd_clk);
>  	}

devm_clk_get() can return NULL if CONFIG_HAVE_CLK is disabled:

static inline struct clk *devm_clk_get(struct device *dev, const char *id)
{
	return NULL;
}

-- 
https://wireless.wiki.kernel.org/en/developers/documentation/submittingpatches

_______________________________________________
ath10k mailing list
ath10k@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/ath10k

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

* Re: [PATCH] ath10k: fix the status check and wrong return
  2020-08-17 14:26   ` Kalle Valo
@ 2020-08-18  1:42     ` Tang Bin
  -1 siblings, 0 replies; 12+ messages in thread
From: Tang Bin @ 2020-08-18  1:42 UTC (permalink / raw)
  To: Kalle Valo; +Cc: davem, netdev, linux-wireless, linux-kernel, ath10k

Hi Kalle:

在 2020/8/17 22:26, Kalle Valo 写道:
>> In the function ath10k_ahb_clock_init(), devm_clk_get() doesn't
>> return NULL. Thus use IS_ERR() and PTR_ERR() to validate
>> the returned value instead of IS_ERR_OR_NULL().
> Why? What's the benefit of this patch? Or what harm does
> IS_ERR_OR_NULL() create?

Thanks for you reply, the benefit of this patch is simplify the code, 
because in

this function, I don't think the situation of 'devm_clk_get() return 
NULL' exists.

So please think about it, thanks.


Tang Bin

>
>> Signed-off-by: Zhang Shengju <zhangshengju@cmss.chinamobile.com>
>> Signed-off-by: Tang Bin <tangbin@cmss.chinamobile.com>
>> ---
>>   drivers/net/wireless/ath/ath10k/ahb.c | 12 ++++++------
>>   1 file changed, 6 insertions(+), 6 deletions(-)
>>
>> diff --git a/drivers/net/wireless/ath/ath10k/ahb.c b/drivers/net/wireless/ath/ath10k/ahb.c
>> index ed87bc00f..ea669af6a 100644
>> --- a/drivers/net/wireless/ath/ath10k/ahb.c
>> +++ b/drivers/net/wireless/ath/ath10k/ahb.c
>> @@ -87,24 +87,24 @@ static int ath10k_ahb_clock_init(struct ath10k *ar)
>>   	dev = &ar_ahb->pdev->dev;
>>   
>>   	ar_ahb->cmd_clk = devm_clk_get(dev, "wifi_wcss_cmd");
>> -	if (IS_ERR_OR_NULL(ar_ahb->cmd_clk)) {
>> +	if (IS_ERR(ar_ahb->cmd_clk)) {
>>   		ath10k_err(ar, "failed to get cmd clk: %ld\n",
>>   			   PTR_ERR(ar_ahb->cmd_clk));
>> -		return ar_ahb->cmd_clk ? PTR_ERR(ar_ahb->cmd_clk) : -ENODEV;
>> +		return PTR_ERR(ar_ahb->cmd_clk);
>>   	}
> devm_clk_get() can return NULL if CONFIG_HAVE_CLK is disabled:
>
> static inline struct clk *devm_clk_get(struct device *dev, const char *id)
> {
> 	return NULL;
> }
>



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

* Re: [PATCH] ath10k: fix the status check and wrong return
@ 2020-08-18  1:42     ` Tang Bin
  0 siblings, 0 replies; 12+ messages in thread
From: Tang Bin @ 2020-08-18  1:42 UTC (permalink / raw)
  To: Kalle Valo; +Cc: netdev, linux-wireless, davem, ath10k, linux-kernel

Hi Kalle:

在 2020/8/17 22:26, Kalle Valo 写道:
>> In the function ath10k_ahb_clock_init(), devm_clk_get() doesn't
>> return NULL. Thus use IS_ERR() and PTR_ERR() to validate
>> the returned value instead of IS_ERR_OR_NULL().
> Why? What's the benefit of this patch? Or what harm does
> IS_ERR_OR_NULL() create?

Thanks for you reply, the benefit of this patch is simplify the code, 
because in

this function, I don't think the situation of 'devm_clk_get() return 
NULL' exists.

So please think about it, thanks.


Tang Bin

>
>> Signed-off-by: Zhang Shengju <zhangshengju@cmss.chinamobile.com>
>> Signed-off-by: Tang Bin <tangbin@cmss.chinamobile.com>
>> ---
>>   drivers/net/wireless/ath/ath10k/ahb.c | 12 ++++++------
>>   1 file changed, 6 insertions(+), 6 deletions(-)
>>
>> diff --git a/drivers/net/wireless/ath/ath10k/ahb.c b/drivers/net/wireless/ath/ath10k/ahb.c
>> index ed87bc00f..ea669af6a 100644
>> --- a/drivers/net/wireless/ath/ath10k/ahb.c
>> +++ b/drivers/net/wireless/ath/ath10k/ahb.c
>> @@ -87,24 +87,24 @@ static int ath10k_ahb_clock_init(struct ath10k *ar)
>>   	dev = &ar_ahb->pdev->dev;
>>   
>>   	ar_ahb->cmd_clk = devm_clk_get(dev, "wifi_wcss_cmd");
>> -	if (IS_ERR_OR_NULL(ar_ahb->cmd_clk)) {
>> +	if (IS_ERR(ar_ahb->cmd_clk)) {
>>   		ath10k_err(ar, "failed to get cmd clk: %ld\n",
>>   			   PTR_ERR(ar_ahb->cmd_clk));
>> -		return ar_ahb->cmd_clk ? PTR_ERR(ar_ahb->cmd_clk) : -ENODEV;
>> +		return PTR_ERR(ar_ahb->cmd_clk);
>>   	}
> devm_clk_get() can return NULL if CONFIG_HAVE_CLK is disabled:
>
> static inline struct clk *devm_clk_get(struct device *dev, const char *id)
> {
> 	return NULL;
> }
>



_______________________________________________
ath10k mailing list
ath10k@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/ath10k

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

* Re: [PATCH] ath10k: fix the status check and wrong return
  2020-08-18  1:42     ` Tang Bin
@ 2020-08-18  4:40       ` Steve deRosier
  -1 siblings, 0 replies; 12+ messages in thread
From: Steve deRosier @ 2020-08-18  4:40 UTC (permalink / raw)
  To: Tang Bin
  Cc: Kalle Valo, David S. Miller, Network Development, linux-wireless,
	LKML, ath10k

On Mon, Aug 17, 2020 at 6:43 PM Tang Bin <tangbin@cmss.chinamobile.com> wrote:
>
> Hi Kalle:
>
> 在 2020/8/17 22:26, Kalle Valo 写道:
> >> In the function ath10k_ahb_clock_init(), devm_clk_get() doesn't
> >> return NULL. Thus use IS_ERR() and PTR_ERR() to validate
> >> the returned value instead of IS_ERR_OR_NULL().
> > Why? What's the benefit of this patch? Or what harm does
> > IS_ERR_OR_NULL() create?
>
> Thanks for you reply, the benefit of this patch is simplify the code,
> because in
>
> this function, I don't think the situation of 'devm_clk_get() return
> NULL' exists.
>

I admit I'm not looking at HEAD, but at least in the two versions I've
got checked out, devm_clk_get() can theoretically return NULL. This
feels like a gratuitous change anyway, but in any case it's wrong and
could cause wrong behavior.

- Steve

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

* Re: [PATCH] ath10k: fix the status check and wrong return
@ 2020-08-18  4:40       ` Steve deRosier
  0 siblings, 0 replies; 12+ messages in thread
From: Steve deRosier @ 2020-08-18  4:40 UTC (permalink / raw)
  To: Tang Bin
  Cc: Network Development, linux-wireless, LKML, ath10k,
	David S. Miller, Kalle Valo

On Mon, Aug 17, 2020 at 6:43 PM Tang Bin <tangbin@cmss.chinamobile.com> wrote:
>
> Hi Kalle:
>
> 在 2020/8/17 22:26, Kalle Valo 写道:
> >> In the function ath10k_ahb_clock_init(), devm_clk_get() doesn't
> >> return NULL. Thus use IS_ERR() and PTR_ERR() to validate
> >> the returned value instead of IS_ERR_OR_NULL().
> > Why? What's the benefit of this patch? Or what harm does
> > IS_ERR_OR_NULL() create?
>
> Thanks for you reply, the benefit of this patch is simplify the code,
> because in
>
> this function, I don't think the situation of 'devm_clk_get() return
> NULL' exists.
>

I admit I'm not looking at HEAD, but at least in the two versions I've
got checked out, devm_clk_get() can theoretically return NULL. This
feels like a gratuitous change anyway, but in any case it's wrong and
could cause wrong behavior.

- Steve

_______________________________________________
ath10k mailing list
ath10k@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/ath10k

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

* Re: [PATCH] ath10k: fix the status check and wrong return
  2020-08-18  1:42     ` Tang Bin
@ 2020-08-18  9:08       ` Kalle Valo
  -1 siblings, 0 replies; 12+ messages in thread
From: Kalle Valo @ 2020-08-18  9:08 UTC (permalink / raw)
  To: Tang Bin; +Cc: netdev, linux-wireless, davem, ath10k, linux-kernel

Tang Bin <tangbin@cmss.chinamobile.com> writes:

> 在 2020/8/17 22:26, Kalle Valo 写道:
>>> In the function ath10k_ahb_clock_init(), devm_clk_get() doesn't
>>> return NULL. Thus use IS_ERR() and PTR_ERR() to validate
>>> the returned value instead of IS_ERR_OR_NULL().
>> Why? What's the benefit of this patch? Or what harm does
>> IS_ERR_OR_NULL() create?
>
> Thanks for you reply, the benefit of this patch is simplify the code,
> because in
>
> this function, I don't think the situation of 'devm_clk_get() return
> NULL' exists.
>
> So please think about it, thanks.

I think you missed my comment below:

>> devm_clk_get() can return NULL if CONFIG_HAVE_CLK is disabled:
>>
>> static inline struct clk *devm_clk_get(struct device *dev, const char *id)
>> {
>> 	return NULL;
>> }

So I think this patch just creates a new bug and does not improve
anything.

-- 
https://wireless.wiki.kernel.org/en/developers/documentation/submittingpatches

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

* Re: [PATCH] ath10k: fix the status check and wrong return
@ 2020-08-18  9:08       ` Kalle Valo
  0 siblings, 0 replies; 12+ messages in thread
From: Kalle Valo @ 2020-08-18  9:08 UTC (permalink / raw)
  To: Tang Bin; +Cc: netdev, linux-wireless, davem, ath10k, linux-kernel

Tang Bin <tangbin@cmss.chinamobile.com> writes:

> 在 2020/8/17 22:26, Kalle Valo 写道:
>>> In the function ath10k_ahb_clock_init(), devm_clk_get() doesn't
>>> return NULL. Thus use IS_ERR() and PTR_ERR() to validate
>>> the returned value instead of IS_ERR_OR_NULL().
>> Why? What's the benefit of this patch? Or what harm does
>> IS_ERR_OR_NULL() create?
>
> Thanks for you reply, the benefit of this patch is simplify the code,
> because in
>
> this function, I don't think the situation of 'devm_clk_get() return
> NULL' exists.
>
> So please think about it, thanks.

I think you missed my comment below:

>> devm_clk_get() can return NULL if CONFIG_HAVE_CLK is disabled:
>>
>> static inline struct clk *devm_clk_get(struct device *dev, const char *id)
>> {
>> 	return NULL;
>> }

So I think this patch just creates a new bug and does not improve
anything.

-- 
https://wireless.wiki.kernel.org/en/developers/documentation/submittingpatches

_______________________________________________
ath10k mailing list
ath10k@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/ath10k

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

end of thread, other threads:[~2020-08-18  9:09 UTC | newest]

Thread overview: 12+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-08-14 14:48 [PATCH] ath10k: fix the status check and wrong return Tang Bin
2020-08-14 14:48 ` Tang Bin
2020-08-14 16:40 ` Tom Psyborg
2020-08-14 16:40   ` Tom Psyborg
2020-08-17 14:26 ` Kalle Valo
2020-08-17 14:26   ` Kalle Valo
2020-08-18  1:42   ` Tang Bin
2020-08-18  1:42     ` Tang Bin
2020-08-18  4:40     ` Steve deRosier
2020-08-18  4:40       ` Steve deRosier
2020-08-18  9:08     ` Kalle Valo
2020-08-18  9:08       ` Kalle Valo

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.