diff mbox

ASoC: atmel: Remove check for node pointer

Message ID 20180122141557.GA29226@lenoch (mailing list archive)
State New, archived
Headers show

Commit Message

Ladislav Michl Jan. 22, 2018, 2:15 p.m. UTC
Probe function is called only after DT compatible is matched,
thus node pointer cannot be NULL.

Signed-off-by: Ladislav Michl <ladis@linux-mips.org>
---
 Note: this patch replaces previously sent
 "ASoC: sam9x5_wm8731: Return -ENODEV when probe does not find OF node" and
 "ASoC: atmel_wm8904: Return -ENODEV when probe does not find OF node"
 while taking Alexandre Belloni's advice into account and extending it for
 the rest of Atmel's drivers.

 sound/soc/atmel/atmel_wm8904.c   | 5 -----
 sound/soc/atmel/sam9g20_wm8731.c | 4 ----
 sound/soc/atmel/sam9x5_wm8731.c  | 5 -----
 sound/soc/atmel/tse850-pcm5142.c | 5 -----
 4 files changed, 19 deletions(-)

Comments

Peter Rosin Jan. 22, 2018, 2:20 p.m. UTC | #1
On 2018-01-22 15:15, Ladislav Michl wrote:
> Probe function is called only after DT compatible is matched,
> thus node pointer cannot be NULL.
> 
> Signed-off-by: Ladislav Michl <ladis@linux-mips.org>

Sure,

Acked-by: Peter Rosin <peda@axentia.se>

Cheers,
peda
Alexandre Belloni Jan. 27, 2018, 9:53 p.m. UTC | #2
On 22/01/2018 at 15:15:57 +0100, Ladislav Michl wrote:
> Probe function is called only after DT compatible is matched,
> thus node pointer cannot be NULL.
> 
> Signed-off-by: Ladislav Michl <ladis@linux-mips.org>
Acked-by: Alexandre Belloni <alexandre.belloni@free-electrons.com>

> ---
>  Note: this patch replaces previously sent
>  "ASoC: sam9x5_wm8731: Return -ENODEV when probe does not find OF node" and
>  "ASoC: atmel_wm8904: Return -ENODEV when probe does not find OF node"
>  while taking Alexandre Belloni's advice into account and extending it for
>  the rest of Atmel's drivers.
> 
>  sound/soc/atmel/atmel_wm8904.c   | 5 -----
>  sound/soc/atmel/sam9g20_wm8731.c | 4 ----
>  sound/soc/atmel/sam9x5_wm8731.c  | 5 -----
>  sound/soc/atmel/tse850-pcm5142.c | 5 -----
>  4 files changed, 19 deletions(-)
> 
> diff --git a/sound/soc/atmel/atmel_wm8904.c b/sound/soc/atmel/atmel_wm8904.c
> index fbc10f61eb55..0619a9961e0c 100644
> --- a/sound/soc/atmel/atmel_wm8904.c
> +++ b/sound/soc/atmel/atmel_wm8904.c
> @@ -85,11 +85,6 @@ static int atmel_asoc_wm8904_dt_init(struct platform_device *pdev)
>  	struct snd_soc_dai_link *dailink = &atmel_asoc_wm8904_dailink;
>  	int ret;
>  
> -	if (!np) {
> -		dev_err(&pdev->dev, "only device tree supported\n");
> -		return -EINVAL;
> -	}
> -
>  	ret = snd_soc_of_parse_card_name(card, "atmel,model");
>  	if (ret) {
>  		dev_err(&pdev->dev, "failed to parse card name\n");
> diff --git a/sound/soc/atmel/sam9g20_wm8731.c b/sound/soc/atmel/sam9g20_wm8731.c
> index 98f93e79c654..a53f3ee82d30 100644
> --- a/sound/soc/atmel/sam9g20_wm8731.c
> +++ b/sound/soc/atmel/sam9g20_wm8731.c
> @@ -163,10 +163,6 @@ static int at91sam9g20ek_audio_probe(struct platform_device *pdev)
>  	struct snd_soc_card *card = &snd_soc_at91sam9g20ek;
>  	int ret;
>  
> -	if (!np) {
> -		return -ENODEV;
> -	}
> -
>  	ret = atmel_ssc_set_audio(0);
>  	if (ret) {
>  		dev_err(&pdev->dev, "ssc channel is not valid\n");
> diff --git a/sound/soc/atmel/sam9x5_wm8731.c b/sound/soc/atmel/sam9x5_wm8731.c
> index 920f72565ff2..b177524f5926 100644
> --- a/sound/soc/atmel/sam9x5_wm8731.c
> +++ b/sound/soc/atmel/sam9x5_wm8731.c
> @@ -83,11 +83,6 @@ static int sam9x5_wm8731_driver_probe(struct platform_device *pdev)
>  	struct sam9x5_drvdata *priv;
>  	int ret;
>  
> -	if (!np) {
> -		dev_err(&pdev->dev, "No device node supplied\n");
> -		return -EINVAL;
> -	}
> -
>  	card = devm_kzalloc(&pdev->dev, sizeof(*card), GFP_KERNEL);
>  	priv = devm_kzalloc(&pdev->dev, sizeof(*priv), GFP_KERNEL);
>  	dai = devm_kzalloc(&pdev->dev, sizeof(*dai), GFP_KERNEL);
> diff --git a/sound/soc/atmel/tse850-pcm5142.c b/sound/soc/atmel/tse850-pcm5142.c
> index 3a1393283156..73b327e781ab 100644
> --- a/sound/soc/atmel/tse850-pcm5142.c
> +++ b/sound/soc/atmel/tse850-pcm5142.c
> @@ -327,11 +327,6 @@ static int tse850_dt_init(struct platform_device *pdev)
>  	struct device_node *codec_np, *cpu_np;
>  	struct snd_soc_dai_link *dailink = &tse850_dailink;
>  
> -	if (!np) {
> -		dev_err(&pdev->dev, "only device tree supported\n");
> -		return -EINVAL;
> -	}
> -
>  	cpu_np = of_parse_phandle(np, "axentia,cpu-dai", 0);
>  	if (!cpu_np) {
>  		dev_err(&pdev->dev, "failed to get cpu dai\n");
> -- 
> 2.15.1
>
diff mbox

Patch

diff --git a/sound/soc/atmel/atmel_wm8904.c b/sound/soc/atmel/atmel_wm8904.c
index fbc10f61eb55..0619a9961e0c 100644
--- a/sound/soc/atmel/atmel_wm8904.c
+++ b/sound/soc/atmel/atmel_wm8904.c
@@ -85,11 +85,6 @@  static int atmel_asoc_wm8904_dt_init(struct platform_device *pdev)
 	struct snd_soc_dai_link *dailink = &atmel_asoc_wm8904_dailink;
 	int ret;
 
-	if (!np) {
-		dev_err(&pdev->dev, "only device tree supported\n");
-		return -EINVAL;
-	}
-
 	ret = snd_soc_of_parse_card_name(card, "atmel,model");
 	if (ret) {
 		dev_err(&pdev->dev, "failed to parse card name\n");
diff --git a/sound/soc/atmel/sam9g20_wm8731.c b/sound/soc/atmel/sam9g20_wm8731.c
index 98f93e79c654..a53f3ee82d30 100644
--- a/sound/soc/atmel/sam9g20_wm8731.c
+++ b/sound/soc/atmel/sam9g20_wm8731.c
@@ -163,10 +163,6 @@  static int at91sam9g20ek_audio_probe(struct platform_device *pdev)
 	struct snd_soc_card *card = &snd_soc_at91sam9g20ek;
 	int ret;
 
-	if (!np) {
-		return -ENODEV;
-	}
-
 	ret = atmel_ssc_set_audio(0);
 	if (ret) {
 		dev_err(&pdev->dev, "ssc channel is not valid\n");
diff --git a/sound/soc/atmel/sam9x5_wm8731.c b/sound/soc/atmel/sam9x5_wm8731.c
index 920f72565ff2..b177524f5926 100644
--- a/sound/soc/atmel/sam9x5_wm8731.c
+++ b/sound/soc/atmel/sam9x5_wm8731.c
@@ -83,11 +83,6 @@  static int sam9x5_wm8731_driver_probe(struct platform_device *pdev)
 	struct sam9x5_drvdata *priv;
 	int ret;
 
-	if (!np) {
-		dev_err(&pdev->dev, "No device node supplied\n");
-		return -EINVAL;
-	}
-
 	card = devm_kzalloc(&pdev->dev, sizeof(*card), GFP_KERNEL);
 	priv = devm_kzalloc(&pdev->dev, sizeof(*priv), GFP_KERNEL);
 	dai = devm_kzalloc(&pdev->dev, sizeof(*dai), GFP_KERNEL);
diff --git a/sound/soc/atmel/tse850-pcm5142.c b/sound/soc/atmel/tse850-pcm5142.c
index 3a1393283156..73b327e781ab 100644
--- a/sound/soc/atmel/tse850-pcm5142.c
+++ b/sound/soc/atmel/tse850-pcm5142.c
@@ -327,11 +327,6 @@  static int tse850_dt_init(struct platform_device *pdev)
 	struct device_node *codec_np, *cpu_np;
 	struct snd_soc_dai_link *dailink = &tse850_dailink;
 
-	if (!np) {
-		dev_err(&pdev->dev, "only device tree supported\n");
-		return -EINVAL;
-	}
-
 	cpu_np = of_parse_phandle(np, "axentia,cpu-dai", 0);
 	if (!cpu_np) {
 		dev_err(&pdev->dev, "failed to get cpu dai\n");