linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] dmaengine: imx-sdma: Remove useless null check before call of_node_put()
@ 2022-04-21  2:49 Haowen Bai
  2022-04-22  6:10 ` Vinod Koul
  0 siblings, 1 reply; 3+ messages in thread
From: Haowen Bai @ 2022-04-21  2:49 UTC (permalink / raw)
  To: Vinod Koul, Shawn Guo, Sascha Hauer, Pengutronix Kernel Team,
	Fabio Estevam, NXP Linux Team
  Cc: Haowen Bai, dmaengine, linux-arm-kernel, linux-kernel

No need to add null check before call of_node_put(), since the
implementation of of_node_put() has done it.

Signed-off-by: Haowen Bai <baihaowen@meizu.com>
---
 drivers/dma/imx-sdma.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/drivers/dma/imx-sdma.c b/drivers/dma/imx-sdma.c
index 6196a7b3956b..b8a1299b93f0 100644
--- a/drivers/dma/imx-sdma.c
+++ b/drivers/dma/imx-sdma.c
@@ -1933,8 +1933,7 @@ static int sdma_event_remap(struct sdma_engine *sdma)
 	}
 
 out:
-	if (gpr_np)
-		of_node_put(gpr_np);
+	of_node_put(gpr_np);
 
 	return ret;
 }
-- 
2.7.4


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

* Re: [PATCH] dmaengine: imx-sdma: Remove useless null check before call of_node_put()
  2022-04-21  2:49 [PATCH] dmaengine: imx-sdma: Remove useless null check before call of_node_put() Haowen Bai
@ 2022-04-22  6:10 ` Vinod Koul
  2022-04-22  6:17   ` baihaowen
  0 siblings, 1 reply; 3+ messages in thread
From: Vinod Koul @ 2022-04-22  6:10 UTC (permalink / raw)
  To: Haowen Bai
  Cc: Shawn Guo, Sascha Hauer, Pengutronix Kernel Team, Fabio Estevam,
	NXP Linux Team, dmaengine, linux-arm-kernel, linux-kernel

On 21-04-22, 10:49, Haowen Bai wrote:
> No need to add null check before call of_node_put(), since the
> implementation of of_node_put() has done it.
> 
> Signed-off-by: Haowen Bai <baihaowen@meizu.com>
> ---
>  drivers/dma/imx-sdma.c | 3 +--
>  1 file changed, 1 insertion(+), 2 deletions(-)
> 
> diff --git a/drivers/dma/imx-sdma.c b/drivers/dma/imx-sdma.c
> index 6196a7b3956b..b8a1299b93f0 100644
> --- a/drivers/dma/imx-sdma.c
> +++ b/drivers/dma/imx-sdma.c
> @@ -1933,8 +1933,7 @@ static int sdma_event_remap(struct sdma_engine *sdma)
>  	}
>  
>  out:
> -	if (gpr_np)
> -		of_node_put(gpr_np);
> +	of_node_put(gpr_np);

this is incorrect as it is called on error case


-- 
~Vinod

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

* Re: [PATCH] dmaengine: imx-sdma: Remove useless null check before call of_node_put()
  2022-04-22  6:10 ` Vinod Koul
@ 2022-04-22  6:17   ` baihaowen
  0 siblings, 0 replies; 3+ messages in thread
From: baihaowen @ 2022-04-22  6:17 UTC (permalink / raw)
  To: Vinod Koul
  Cc: Shawn Guo, Sascha Hauer, Pengutronix Kernel Team, Fabio Estevam,
	NXP Linux Team, dmaengine, linux-arm-kernel, linux-kernel

在 4/22/22 2:10 PM, Vinod Koul 写道:
> On 21-04-22, 10:49, Haowen Bai wrote:
>> No need to add null check before call of_node_put(), since the
>> implementation of of_node_put() has done it.
>>
>> Signed-off-by: Haowen Bai <baihaowen@meizu.com>
>> ---
>>  drivers/dma/imx-sdma.c | 3 +--
>>  1 file changed, 1 insertion(+), 2 deletions(-)
>>
>> diff --git a/drivers/dma/imx-sdma.c b/drivers/dma/imx-sdma.c
>> index 6196a7b3956b..b8a1299b93f0 100644
>> --- a/drivers/dma/imx-sdma.c
>> +++ b/drivers/dma/imx-sdma.c
>> @@ -1933,8 +1933,7 @@ static int sdma_event_remap(struct sdma_engine *sdma)
>>  	}
>>  
>>  out:
>> -	if (gpr_np)
>> -		of_node_put(gpr_np);
>> +	of_node_put(gpr_np);
> this is incorrect as it is called on error case
>
>
Even through it is called on error case, gpr_np=null, but  of_node_put
did a null check.
void of_node_put(struct device_node *node)

{ if (node) kobject_put(&node->kobj); }

-- 
Haowen Bai


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

end of thread, other threads:[~2022-04-22  6:17 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-04-21  2:49 [PATCH] dmaengine: imx-sdma: Remove useless null check before call of_node_put() Haowen Bai
2022-04-22  6:10 ` Vinod Koul
2022-04-22  6:17   ` baihaowen

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