diff mbox

[1/1] ASoC: mop500: Deletion of unnecessary checks before the function call "of_node_put"

Message ID 547DEB6B.5000105@users.sourceforge.net (mailing list archive)
State Accepted
Commit 1679b532870f565bc184434f545cdbd3fdeff6cf
Headers show

Commit Message

SF Markus Elfring Dec. 2, 2014, 4:40 p.m. UTC
From: Markus Elfring <elfring@users.sourceforge.net>
Date: Tue, 2 Dec 2014 17:15:11 +0100

The of_node_put() function tests whether its argument is NULL and then
returns immediately. Thus the test around the call is not needed.

This issue was detected by using the Coccinelle software.

Signed-off-by: Markus Elfring <elfring@users.sourceforge.net>
---
 sound/soc/ux500/mop500.c | 6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)

Comments

Mark Brown Dec. 3, 2014, 6:30 p.m. UTC | #1
On Tue, Dec 02, 2014 at 05:40:11PM +0100, SF Markus Elfring wrote:
> From: Markus Elfring <elfring@users.sourceforge.net>
> Date: Tue, 2 Dec 2014 17:15:11 +0100
> 
> The of_node_put() function tests whether its argument is NULL and then
> returns immediately. Thus the test around the call is not needed.

This doesn't apply against current code, please check and resend.
Mark Brown Dec. 3, 2014, 6:31 p.m. UTC | #2
On Tue, Dec 02, 2014 at 05:40:11PM +0100, SF Markus Elfring wrote:
> From: Markus Elfring <elfring@users.sourceforge.net>
> Date: Tue, 2 Dec 2014 17:15:11 +0100
> 
> The of_node_put() function tests whether its argument is NULL and then
> returns immediately. Thus the test around the call is not needed.

Sorry, realised what the dependency was - applied, thanks.
diff mbox

Patch

diff --git a/sound/soc/ux500/mop500.c b/sound/soc/ux500/mop500.c
index 7f7093b..4e0c0e5 100644
--- a/sound/soc/ux500/mop500.c
+++ b/sound/soc/ux500/mop500.c
@@ -63,10 +63,8 @@  static void mop500_of_node_put(void)
 	int i;
 
 	for (i = 0; i < 2; i++) {
-		if (mop500_dai_links[i].cpu_of_node)
-			of_node_put(mop500_dai_links[i].cpu_of_node);
-		if (mop500_dai_links[i].codec_of_node)
-			of_node_put(mop500_dai_links[i].codec_of_node);
+		of_node_put(mop500_dai_links[i].cpu_of_node);
+		of_node_put(mop500_dai_links[i].codec_of_node);
 	}
 }