Skip to contentSkip to conversation

ASoC: atmel: Remove check for node pointer

PATCH In review Ladislav Michl 3 participants 3 messages Jan 22, 2018 – Jan 27, 2018

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

PATCH 1/1 ASoC: atmel: Remove check for node pointer

Probe function is called only after DT compatible is matched, thus node pointer cannot be NULL.

---
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(-)
sound/soc/atmel/atmel_wm8904.c +0 -5
index fbc10f61eb55..0619a9961e0c 100644
@@ -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");
sound/soc/atmel/sam9g20_wm8731.c +0 -4
index 98f93e79c654..a53f3ee82d30 100644
@@ -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");
sound/soc/atmel/sam9x5_wm8731.c +0 -5
index 920f72565ff2..b177524f5926 100644
@@ -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);
sound/soc/atmel/tse850-pcm5142.c +0 -5
index 3a1393283156..73b327e781ab 100644
@@ -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");
Signature · 1 line
2.15.1
Acked-by on v1 1/1
#2 lore raw
In reply to Ladislav Michl
Quoted 4 lines · Ladislav Michl

Probe function is called only after DT compatible is matched, thus node pointer cannot be NULL.

Quoted 79 lines

---
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(-)
sound/soc/atmel/atmel_wm8904.c +0 -5
index fbc10f61eb55..0619a9961e0c 100644
@@ -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");
sound/soc/atmel/sam9g20_wm8731.c +0 -4
index 98f93e79c654..a53f3ee82d30 100644
@@ -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");
sound/soc/atmel/sam9x5_wm8731.c +0 -5
index 920f72565ff2..b177524f5926 100644
@@ -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);
sound/soc/atmel/tse850-pcm5142.c +0 -5
index 3a1393283156..73b327e781ab 100644
@@ -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");
Signature · 1 line
2.15.1
Signature · 3 lines
Alexandre Belloni, Free Electrons
Embedded Linux and Kernel engineering
http://free-electrons.com