Discussion:
[PATCH 1/4] ASoC: mc13783: Delete unneeded test before of_node_put
Fabio Estevam
2014-10-07 18:29:55 UTC
Permalink
of_node_put() supports NULL as its argument, so the initial test is not
necessary.

Signed-off-by: Fabio Estevam <***@freescale.com>
---
sound/soc/codecs/mc13783.c | 3 +--
1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/sound/soc/codecs/mc13783.c b/sound/soc/codecs/mc13783.c
index 2c1f1b0..388f90a 100644
--- a/sound/soc/codecs/mc13783.c
+++ b/sound/soc/codecs/mc13783.c
@@ -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;
}
--
1.9.1
Fabio Estevam
2014-10-07 18:29:56 UTC
Permalink
of_node_put() supports NULL as its argument, so the initial test is not
necessary.

Signed-off-by: Fabio Estevam <***@freescale.com>
---
sound/soc/fsl/imx-spdif.c | 3 +--
1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/sound/soc/fsl/imx-spdif.c b/sound/soc/fsl/imx-spdif.c
index e1dc401..0c9068e 100644
--- a/sound/soc/fsl/imx-spdif.c
+++ b/sound/soc/fsl/imx-spdif.c
@@ -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;
}
--
1.9.1
Nicolin Chen
2014-10-07 18:42:03 UTC
Permalink
Post by 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
Post by Fabio Estevam
---
sound/soc/fsl/imx-spdif.c | 3 +--
1 file changed, 1 insertion(+), 2 deletions(-)
diff --git a/sound/soc/fsl/imx-spdif.c b/sound/soc/fsl/imx-spdif.c
index e1dc401..0c9068e 100644
--- a/sound/soc/fsl/imx-spdif.c
+++ b/sound/soc/fsl/imx-spdif.c
@@ -74,8 +74,7 @@ static int imx_spdif_audio_probe(struct platform_device *pdev)
platform_set_drvdata(pdev, data);
- if (spdif_np)
- of_node_put(spdif_np);
+ of_node_put(spdif_np);
return ret;
}
--
1.9.1
Mark Brown
2014-10-07 19:01:22 UTC
Permalink
Post by Fabio Estevam
of_node_put() supports NULL as its argument, so the initial test is not
necessary.
Applied, thanks.
Fabio Estevam
2014-10-07 18:29:57 UTC
Permalink
of_node_put() supports NULL as its argument, so the initial test is not
necessary.

Signed-off-by: Fabio Estevam <***@freescale.com>
---
sound/soc/fsl/eukrea-tlv320.c | 3 +--
1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/sound/soc/fsl/eukrea-tlv320.c b/sound/soc/fsl/eukrea-tlv320.c
index eb093d5..dd931fa 100644
--- a/sound/soc/fsl/eukrea-tlv320.c
+++ b/sound/soc/fsl/eukrea-tlv320.c
@@ -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;
}
--
1.9.1
Mark Brown
2014-10-07 19:01:31 UTC
Permalink
Post by Fabio Estevam
of_node_put() supports NULL as its argument, so the initial test is not
necessary.
Applied, thanks.
Fabio Estevam
2014-10-07 18:29:58 UTC
Permalink
of_node_put() supports NULL as its argument, so the initial test is not
necessary.

Signed-off-by: Fabio Estevam <***@freescale.com>
---
sound/soc/generic/simple-card.c | 15 +++++----------
1 file changed, 5 insertions(+), 10 deletions(-)

diff --git a/sound/soc/generic/simple-card.c b/sound/soc/generic/simple-card.c
index fcb431f..ecba061 100644
--- a/sound/soc/generic/simple-card.c
+++ b/sound/soc/generic/simple-card.c
@@ -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;
}
--
1.9.1
Mark Brown
2014-10-07 19:02:21 UTC
Permalink
Post by 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.
Mark Brown
2014-10-07 18:59:25 UTC
Permalink
Post by Fabio Estevam
- if (np)
- of_node_put(np);
+ of_node_put(np);
This doesn't apply against current code, there's no np check?
Loading...