linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 0/2] ethernet: Use NULL to compare with pointer-typed value rather than 0
@ 2018-08-18  6:29 zhong jiang
  2018-08-18  6:29 ` [PATCH 1/2] ethernet: declance: " zhong jiang
                   ` (2 more replies)
  0 siblings, 3 replies; 7+ messages in thread
From: zhong jiang @ 2018-08-18  6:29 UTC (permalink / raw)
  To: davem; +Cc: vz, slemieux.tyco, keescook, netdev, linux-kernel

v1->v2:
 - According to Vladimir's suggestion. change a common 0 and NULL comparsion form.

zhong jiang (2):
  ethernet: declance:  Use NULL to compare with pointer-typed value
    rather than 0
  ethernet: lpc_eth: Use NULL to compare with pointer-typed value
    rather than 0

 drivers/net/ethernet/amd/declance.c | 3 +--
 drivers/net/ethernet/nxp/lpc_eth.c  | 2 +-
 2 files changed, 2 insertions(+), 3 deletions(-)

-- 
1.7.12.4


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

* [PATCH 1/2] ethernet: declance:  Use NULL to compare with pointer-typed value rather than 0
  2018-08-18  6:29 [PATCH 0/2] ethernet: Use NULL to compare with pointer-typed value rather than 0 zhong jiang
@ 2018-08-18  6:29 ` zhong jiang
  2018-08-18  6:29 ` [PATCH 2/2] ethernet: lpc_eth: " zhong jiang
  2018-08-18  6:45 ` [PATCH 0/2] ethernet: " zhong jiang
  2 siblings, 0 replies; 7+ messages in thread
From: zhong jiang @ 2018-08-18  6:29 UTC (permalink / raw)
  To: davem; +Cc: vz, slemieux.tyco, keescook, netdev, linux-kernel

We should use NULL to compare with pointer-typed value rather than
0. The issue is detected with the help of Coccinelle.

Signed-off-by: zhong jiang <zhongjiang@huawei.com>
---
 drivers/net/ethernet/amd/declance.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/drivers/net/ethernet/amd/declance.c b/drivers/net/ethernet/amd/declance.c
index 116997a..c636f02 100644
--- a/drivers/net/ethernet/amd/declance.c
+++ b/drivers/net/ethernet/amd/declance.c
@@ -606,8 +606,7 @@ static int lance_rx(struct net_device *dev)
 		} else {
 			len = (*rds_ptr(rd, mblength, lp->type) & 0xfff) - 4;
 			skb = netdev_alloc_skb(dev, len + 2);
-
-			if (skb == 0) {
+			if (!skb) {
 				dev->stats.rx_dropped++;
 				*rds_ptr(rd, mblength, lp->type) = 0;
 				*rds_ptr(rd, rmd1, lp->type) =
-- 
1.7.12.4


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

* [PATCH 2/2] ethernet: lpc_eth: Use NULL to compare with pointer-typed value rather than 0
  2018-08-18  6:29 [PATCH 0/2] ethernet: Use NULL to compare with pointer-typed value rather than 0 zhong jiang
  2018-08-18  6:29 ` [PATCH 1/2] ethernet: declance: " zhong jiang
@ 2018-08-18  6:29 ` zhong jiang
  2018-08-18  6:45 ` [PATCH 0/2] ethernet: " zhong jiang
  2 siblings, 0 replies; 7+ messages in thread
From: zhong jiang @ 2018-08-18  6:29 UTC (permalink / raw)
  To: davem; +Cc: vz, slemieux.tyco, keescook, netdev, linux-kernel

We should use NULL to compare with pointer-typed value rather than 0.
The issue is detected with the help of Coccinelle.

Acked-by: Vladimir Zapolskiy <vz@mleia.com>
Signed-off-by: zhong jiang <zhongjiang@huawei.com>
---
 drivers/net/ethernet/nxp/lpc_eth.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/net/ethernet/nxp/lpc_eth.c b/drivers/net/ethernet/nxp/lpc_eth.c
index 08381ef..1c41b07 100644
--- a/drivers/net/ethernet/nxp/lpc_eth.c
+++ b/drivers/net/ethernet/nxp/lpc_eth.c
@@ -1350,7 +1350,7 @@ static int lpc_eth_drv_probe(struct platform_device *pdev)
 				"IRAM not big enough for net buffers, using SDRAM instead.\n");
 	}
 
-	if (pldat->dma_buff_base_v == 0) {
+	if (!pldat->dma_buff_base_v) {
 		ret = dma_coerce_mask_and_coherent(&pdev->dev, DMA_BIT_MASK(32));
 		if (ret)
 			goto err_out_free_irq;
-- 
1.7.12.4


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

* Re: [PATCH 0/2] ethernet: Use NULL to compare with pointer-typed value rather than 0
  2018-08-18  6:29 [PATCH 0/2] ethernet: Use NULL to compare with pointer-typed value rather than 0 zhong jiang
  2018-08-18  6:29 ` [PATCH 1/2] ethernet: declance: " zhong jiang
  2018-08-18  6:29 ` [PATCH 2/2] ethernet: lpc_eth: " zhong jiang
@ 2018-08-18  6:45 ` zhong jiang
  2 siblings, 0 replies; 7+ messages in thread
From: zhong jiang @ 2018-08-18  6:45 UTC (permalink / raw)
  To: davem; +Cc: vz, slemieux.tyco, keescook, netdev, linux-kernel

ingore the patchset.  should be change the title  from [patch] to [patchv2].
On 2018/8/18 14:29, zhong jiang wrote:
> v1->v2:
>  - According to Vladimir's suggestion. change a common 0 and NULL comparsion form.
>
> zhong jiang (2):
>   ethernet: declance:  Use NULL to compare with pointer-typed value
>     rather than 0
>   ethernet: lpc_eth: Use NULL to compare with pointer-typed value
>     rather than 0
>
>  drivers/net/ethernet/amd/declance.c | 3 +--
>  drivers/net/ethernet/nxp/lpc_eth.c  | 2 +-
>  2 files changed, 2 insertions(+), 3 deletions(-)
>



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

* Re: [PATCH 2/2] ethernet: lpc_eth: Use NULL to compare with pointer-typed value rather than 0
  2018-08-17 15:29   ` Vladimir Zapolskiy
@ 2018-08-18  5:59     ` zhong jiang
  0 siblings, 0 replies; 7+ messages in thread
From: zhong jiang @ 2018-08-18  5:59 UTC (permalink / raw)
  To: Vladimir Zapolskiy; +Cc: davem, slemieux.tyco, keescook, netdev, linux-kernel

On 2018/8/17 23:29, Vladimir Zapolskiy wrote:
> Hi zhong jiang,
>
> On 08/17/2018 04:18 PM, zhong jiang wrote:
>> We should use NULL to compare with pointer-typed value rather than 0.
>> The issue is detected with the help of Coccinelle.
>> ---
>>  drivers/net/ethernet/nxp/lpc_eth.c | 2 +-
>>  1 file changed, 1 insertion(+), 1 deletion(-)
>>
>> diff --git a/drivers/net/ethernet/nxp/lpc_eth.c b/drivers/net/ethernet/nxp/lpc_eth.c
>> index 08381ef..04d9e62 100644
>> --- a/drivers/net/ethernet/nxp/lpc_eth.c
>> +++ b/drivers/net/ethernet/nxp/lpc_eth.c
>> @@ -1350,7 +1350,7 @@ static int lpc_eth_drv_probe(struct platform_device *pdev)
>>  				"IRAM not big enough for net buffers, using SDRAM instead.\n");
>>  	}
>>  
>> -	if (pldat->dma_buff_base_v == 0) {
>> +	if (pldat->dma_buff_base_v == NULL) {
> That's a valid finding, but please use a common 0 and NULL comparison in form of
>
> 	if (!pldat->dma_buff_base_v)
>
> To the change above please feel free to add my
>
> Acked-by: Vladimir Zapolskiy <vz@mleia.com>
 Thanks, Will do in v2
>>  		ret = dma_coerce_mask_and_coherent(&pdev->dev, DMA_BIT_MASK(32));
>>  		if (ret)
>>  			goto err_out_free_irq;
>>
>
> .
>



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

* Re: [PATCH 2/2] ethernet: lpc_eth: Use NULL to compare with pointer-typed value rather than 0
  2018-08-17 13:18 ` [PATCH 2/2] ethernet: lpc_eth: " zhong jiang
@ 2018-08-17 15:29   ` Vladimir Zapolskiy
  2018-08-18  5:59     ` zhong jiang
  0 siblings, 1 reply; 7+ messages in thread
From: Vladimir Zapolskiy @ 2018-08-17 15:29 UTC (permalink / raw)
  To: zhong jiang, davem; +Cc: slemieux.tyco, keescook, netdev, linux-kernel

Hi zhong jiang,

On 08/17/2018 04:18 PM, zhong jiang wrote:
> We should use NULL to compare with pointer-typed value rather than 0.
> The issue is detected with the help of Coccinelle.
> ---
>  drivers/net/ethernet/nxp/lpc_eth.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/net/ethernet/nxp/lpc_eth.c b/drivers/net/ethernet/nxp/lpc_eth.c
> index 08381ef..04d9e62 100644
> --- a/drivers/net/ethernet/nxp/lpc_eth.c
> +++ b/drivers/net/ethernet/nxp/lpc_eth.c
> @@ -1350,7 +1350,7 @@ static int lpc_eth_drv_probe(struct platform_device *pdev)
>  				"IRAM not big enough for net buffers, using SDRAM instead.\n");
>  	}
>  
> -	if (pldat->dma_buff_base_v == 0) {
> +	if (pldat->dma_buff_base_v == NULL) {

That's a valid finding, but please use a common 0 and NULL comparison in form of

	if (!pldat->dma_buff_base_v)

To the change above please feel free to add my

Acked-by: Vladimir Zapolskiy <vz@mleia.com>

>  		ret = dma_coerce_mask_and_coherent(&pdev->dev, DMA_BIT_MASK(32));
>  		if (ret)
>  			goto err_out_free_irq;
> 


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

* [PATCH 2/2] ethernet: lpc_eth: Use NULL to compare with pointer-typed value rather than 0
  2018-08-17 13:18 zhong jiang
@ 2018-08-17 13:18 ` zhong jiang
  2018-08-17 15:29   ` Vladimir Zapolskiy
  0 siblings, 1 reply; 7+ messages in thread
From: zhong jiang @ 2018-08-17 13:18 UTC (permalink / raw)
  To: davem; +Cc: vz, slemieux.tyco, keescook, netdev, linux-kernel

We should use NULL to compare with pointer-typed value rather than 0.
The issue is detected with the help of Coccinelle.
---
 drivers/net/ethernet/nxp/lpc_eth.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/net/ethernet/nxp/lpc_eth.c b/drivers/net/ethernet/nxp/lpc_eth.c
index 08381ef..04d9e62 100644
--- a/drivers/net/ethernet/nxp/lpc_eth.c
+++ b/drivers/net/ethernet/nxp/lpc_eth.c
@@ -1350,7 +1350,7 @@ static int lpc_eth_drv_probe(struct platform_device *pdev)
 				"IRAM not big enough for net buffers, using SDRAM instead.\n");
 	}
 
-	if (pldat->dma_buff_base_v == 0) {
+	if (pldat->dma_buff_base_v == NULL) {
 		ret = dma_coerce_mask_and_coherent(&pdev->dev, DMA_BIT_MASK(32));
 		if (ret)
 			goto err_out_free_irq;
-- 
1.7.12.4


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

end of thread, other threads:[~2018-08-18  6:46 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-08-18  6:29 [PATCH 0/2] ethernet: Use NULL to compare with pointer-typed value rather than 0 zhong jiang
2018-08-18  6:29 ` [PATCH 1/2] ethernet: declance: " zhong jiang
2018-08-18  6:29 ` [PATCH 2/2] ethernet: lpc_eth: " zhong jiang
2018-08-18  6:45 ` [PATCH 0/2] ethernet: " zhong jiang
  -- strict thread matches above, loose matches on Subject: below --
2018-08-17 13:18 zhong jiang
2018-08-17 13:18 ` [PATCH 2/2] ethernet: lpc_eth: " zhong jiang
2018-08-17 15:29   ` Vladimir Zapolskiy
2018-08-18  5:59     ` zhong jiang

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