diff mbox

[3/5] ASoC: sam9x5_wm8731: Return -ENODEV when probe does not find OF node

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

Commit Message

Ladislav Michl Jan. 15, 2018, 7:53 a.m. UTC
Probe should fail with -ENODEV when called with NULL pdev->dev.of_node.

Signed-off-by: Ladislav Michl <ladis@linux-mips.org>
---
 sound/soc/atmel/sam9x5_wm8731.c | 6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)

Comments

Alexandre Belloni Jan. 15, 2018, 8:20 a.m. UTC | #1
On 15/01/2018 at 08:53:51 +0100, Ladislav Michl wrote:
> Probe should fail with -ENODEV when called with NULL pdev->dev.of_node.
> 
> Signed-off-by: Ladislav Michl <ladis@linux-mips.org>
> ---
>  sound/soc/atmel/sam9x5_wm8731.c | 6 ++----
>  1 file changed, 2 insertions(+), 4 deletions(-)
> 
> diff --git a/sound/soc/atmel/sam9x5_wm8731.c b/sound/soc/atmel/sam9x5_wm8731.c
> index e6c303ab869d..9db08826b32a 100644
> --- a/sound/soc/atmel/sam9x5_wm8731.c
> +++ b/sound/soc/atmel/sam9x5_wm8731.c
> @@ -84,10 +84,8 @@ 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;
> -	}
> +	if (!np)
> +		return -ENODEV;
>  

This will never happen, you may as well just remove the test.

>  	card = devm_kzalloc(&pdev->dev, sizeof(*card), GFP_KERNEL);
>  	priv = devm_kzalloc(&pdev->dev, sizeof(*priv), GFP_KERNEL);
> -- 
> 2.15.1
>
Ladislav Michl Jan. 15, 2018, 9:11 a.m. UTC | #2
On Mon, Jan 15, 2018 at 09:20:25AM +0100, Alexandre Belloni wrote:
> On 15/01/2018 at 08:53:51 +0100, Ladislav Michl wrote:
> > Probe should fail with -ENODEV when called with NULL pdev->dev.of_node.
> > 
> > Signed-off-by: Ladislav Michl <ladis@linux-mips.org>
> > ---
> >  sound/soc/atmel/sam9x5_wm8731.c | 6 ++----
> >  1 file changed, 2 insertions(+), 4 deletions(-)
> > 
> > diff --git a/sound/soc/atmel/sam9x5_wm8731.c b/sound/soc/atmel/sam9x5_wm8731.c
> > index e6c303ab869d..9db08826b32a 100644
> > --- a/sound/soc/atmel/sam9x5_wm8731.c
> > +++ b/sound/soc/atmel/sam9x5_wm8731.c
> > @@ -84,10 +84,8 @@ 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;
> > -	}
> > +	if (!np)
> > +		return -ENODEV;
> >  
> 
> This will never happen, you may as well just remove the test.

Ah, right, this is DT only driver. And the same for the patch 5.

Btw, all that drivers seems to be for development boards, so what
about moving to simple card instead? (and let these special drivers
die silently)

> >  	card = devm_kzalloc(&pdev->dev, sizeof(*card), GFP_KERNEL);
> >  	priv = devm_kzalloc(&pdev->dev, sizeof(*priv), GFP_KERNEL);
> > -- 
> > 2.15.1
> > 
> 
> -- 
> Alexandre Belloni, Free Electrons
> Embedded Linux and Kernel engineering
> http://free-electrons.com
Alexandre Belloni Jan. 15, 2018, 9:22 a.m. UTC | #3
On 15/01/2018 at 10:11:14 +0100, Ladislav Michl wrote:
> On Mon, Jan 15, 2018 at 09:20:25AM +0100, Alexandre Belloni wrote:
> > On 15/01/2018 at 08:53:51 +0100, Ladislav Michl wrote:
> > > Probe should fail with -ENODEV when called with NULL pdev->dev.of_node.
> > > 
> > > Signed-off-by: Ladislav Michl <ladis@linux-mips.org>
> > > ---
> > >  sound/soc/atmel/sam9x5_wm8731.c | 6 ++----
> > >  1 file changed, 2 insertions(+), 4 deletions(-)
> > > 
> > > diff --git a/sound/soc/atmel/sam9x5_wm8731.c b/sound/soc/atmel/sam9x5_wm8731.c
> > > index e6c303ab869d..9db08826b32a 100644
> > > --- a/sound/soc/atmel/sam9x5_wm8731.c
> > > +++ b/sound/soc/atmel/sam9x5_wm8731.c
> > > @@ -84,10 +84,8 @@ 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;
> > > -	}
> > > +	if (!np)
> > > +		return -ENODEV;
> > >  
> > 
> > This will never happen, you may as well just remove the test.
> 
> Ah, right, this is DT only driver. And the same for the patch 5.
> 
> Btw, all that drivers seems to be for development boards, so what
> about moving to simple card instead? (and let these special drivers
> die silently)
> 

Yes, that would be good, I'm all for it. However, I think some custom
boards are using those drivers and are not upstream and will also need
to be migrated or at least have a proper migration path.
diff mbox

Patch

diff --git a/sound/soc/atmel/sam9x5_wm8731.c b/sound/soc/atmel/sam9x5_wm8731.c
index e6c303ab869d..9db08826b32a 100644
--- a/sound/soc/atmel/sam9x5_wm8731.c
+++ b/sound/soc/atmel/sam9x5_wm8731.c
@@ -84,10 +84,8 @@  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;
-	}
+	if (!np)
+		return -ENODEV;
 
 	card = devm_kzalloc(&pdev->dev, sizeof(*card), GFP_KERNEL);
 	priv = devm_kzalloc(&pdev->dev, sizeof(*priv), GFP_KERNEL);