Skip to contentSkip to conversation

ASoC: mc13783: Delete unneeded test before of_node_put

PATCH Applied Fabio Estevam 3 participants 9 messages Oct 7, 2014

Subsystems (5)
lore
Share & tools
lore
#0 lore raw

PATCH 1/4 ASoC: mc13783: Delete unneeded test before of_node_put

of_node_put() supports NULL as its argument, so the initial test is not necessary.

---
 sound/soc/codecs/mc13783.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)
sound/soc/codecs/mc13783.c +1 -2
index 2c1f1b0..388f90a 100644
@@ -784,8 +784,7 @@ static int __init mc13783_codec_probe(struct platform_device *pdev)
 			mc13783_dai_async, ARRAY_SIZE(mc13783_dai_async));
 
 out:
-	if (np)
-		of_node_put(np);
+	of_node_put(np);
 	return ret;
 }
 
Signature · 1 line
1.9.1
#1 lore raw

PATCH 2/4 ASoC: fsl: imx-spdif: Delete unneeded test before of_node_put

of_node_put() supports NULL as its argument, so the initial test is not necessary.

---
 sound/soc/fsl/imx-spdif.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)
sound/soc/fsl/imx-spdif.c +1 -2
index e1dc401..0c9068e 100644
@@ -74,8 +74,7 @@ static int imx_spdif_audio_probe(struct platform_device *pdev)
 	platform_set_drvdata(pdev, data);
 
 end:
-	if (spdif_np)
-		of_node_put(spdif_np);
+	of_node_put(spdif_np);
 
 	return ret;
 }
Signature · 1 line
1.9.1
reviewer
#2 lore raw

Re: [PATCH 2/4] ASoC: fsl: imx-spdif: Delete unneeded test before of_node_put

Quoted 4 lines · Fabio Estevam

of_node_put() supports NULL as its argument, so the initial test is not necessary.

Acked for two fsl ones.

Thank you again
Nicolin

Quoted 21 lines
---
 sound/soc/fsl/imx-spdif.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)
sound/soc/fsl/imx-spdif.c +1 -2
index e1dc401..0c9068e 100644
@@ -74,8 +74,7 @@ static int imx_spdif_audio_probe(struct platform_device *pdev)
 	platform_set_drvdata(pdev, data);
 
 end:
-	if (spdif_np)
-		of_node_put(spdif_np);
+	of_node_put(spdif_np);
 
 	return ret;
 }
Signature · 1 line
1.9.1
maintainer Applied
#3 lore raw

Re: [PATCH 2/4] ASoC: fsl: imx-spdif: Delete unneeded test before of_node_put

In reply to Fabio Estevam
Quoted 2 lines · Fabio Estevam

of_node_put() supports NULL as its argument, so the initial test is not necessary.

Applied, thanks.

#4 lore raw

PATCH 3/4 ASoC: fsl: eukrea-tlv320: Delete unneeded test before of_node_put

In reply to Fabio Estevam

of_node_put() supports NULL as its argument, so the initial test is not necessary.

---
 sound/soc/fsl/eukrea-tlv320.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)
sound/soc/fsl/eukrea-tlv320.c +1 -2
index eb093d5..dd931fa 100644
@@ -217,8 +217,7 @@ static int eukrea_tlv320_probe(struct platform_device *pdev)
 err:
 	if (ret)
 		dev_err(&pdev->dev, "snd_soc_register_card failed (%d)\n", ret);
-	if (np)
-		of_node_put(ssi_np);
+	of_node_put(ssi_np);
 
 	return ret;
 }
Signature · 1 line
1.9.1
maintainer Applied
#5 lore raw

Re: [PATCH 3/4] ASoC: fsl: eukrea-tlv320: Delete unneeded test before of_node_put

Quoted 2 lines · Fabio Estevam

of_node_put() supports NULL as its argument, so the initial test is not necessary.

Applied, thanks.

#6 lore raw

PATCH 4/4 ASoC: simple-card: Delete unneeded test before of_node_put

In reply to Fabio Estevam

of_node_put() supports NULL as its argument, so the initial test is not necessary.

---
 sound/soc/generic/simple-card.c | 15 +++++----------
 1 file changed, 5 insertions(+), 10 deletions(-)
sound/soc/generic/simple-card.c +5 -10
index fcb431f..ecba061 100644
@@ -368,12 +368,9 @@ static int asoc_simple_card_dai_link_of(struct device_node *node,
 		dai_link->cpu_dai_name = NULL;
 
 dai_link_of_err:
-	if (np)
-		of_node_put(np);
-	if (bitclkmaster)
-		of_node_put(bitclkmaster);
-	if (framemaster)
-		of_node_put(framemaster);
+	of_node_put(np);
+	of_node_put(bitclkmaster);
+	of_node_put(framemaster);
 	return ret;
 }
 
@@ -464,11 +461,9 @@ static int asoc_simple_card_unref(struct platform_device *pdev)
 	     num_links < card->num_links;
 	     num_links++, dai_link++) {
 		np = (struct device_node *) dai_link->cpu_of_node;
-		if (np)
-			of_node_put(np);
+		of_node_put(np);
 		np = (struct device_node *) dai_link->codec_of_node;
-		if (np)
-			of_node_put(np);
+		of_node_put(np);
 	}
 	return 0;
 }
Signature · 1 line
1.9.1
maintainer Applied
#7 lore raw

Re: [PATCH 4/4] ASoC: simple-card: Delete unneeded test before of_node_put

Quoted 2 lines · Fabio Estevam

of_node_put() supports NULL as its argument, so the initial test is not necessary.

Applied, thanks, but please CC people who typically work on the code.

maintainer
#8 lore raw
In reply to Fabio Estevam

sound/soc/codecs/mc13783.c static int __init mc13783_codec_probe(struct platform_device *pdev) · line 787

Quoted 4 lines · Fabio Estevam

out:

sound/soc/codecs/mc13783.c +1 -2
-	if (np)
-		of_node_put(np);
+	of_node_put(np);

This doesn't apply against current code, there's no np check?