diff mbox

[v2,1/6] ASoC: dwc: Remove unnecessary debug messages and tests

Message ID 97f65b6037b9ac676f6ca7717a230a68cbe81fd1.1418372910.git.Andrew.Jackson@arm.com (mailing list archive)
State New, archived
Headers show

Commit Message

Andrew Jackson Dec. 12, 2014, 9:25 a.m. UTC
From: Andrew Jackson <Andrew.Jackson@arm.com>

The devm_XXX allocation functions print a message on failure,
so additional messages are not required.

Signed-off-by: Andrew Jackson <Andrew.Jackson@arm.com>
---
 sound/soc/dwc/designware_i2s.c |   13 ++-----------
 1 files changed, 2 insertions(+), 11 deletions(-)

Comments

Joe Perches Dec. 12, 2014, 9:31 a.m. UTC | #1
On Fri, 2014-12-12 at 09:25 +0000, Andrew Jackson wrote:
> The devm_XXX allocation functions print a message on failure,
> so additional messages are not required.
[]
> diff --git a/sound/soc/dwc/designware_i2s.c b/sound/soc/dwc/designware_i2s.c
[]
> @@ -345,26 +345,17 @@ static int dw_i2s_probe(struct platform_device *pdev)
>  	}
>  
>  	dw_i2s_dai = devm_kzalloc(&pdev->dev, sizeof(*dw_i2s_dai), GFP_KERNEL);
> -	if (!dw_i2s_dai) {
> -		dev_err(&pdev->dev, "mem allocation failed for dai driver\n");
> +	if (!dw_i2s_dai)
>  		return -ENOMEM;
> -	}

ok.
 
>  	dw_i2s_dai->ops = &dw_i2s_dai_ops;
>  	dw_i2s_dai->suspend = dw_i2s_suspend;
>  	dw_i2s_dai->resume = dw_i2s_resume;
>  
>  	res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
> -	if (!res) {
> -		dev_err(&pdev->dev, "no i2s resource defined\n");
> -		return -ENODEV;
> -	}
> -

Why delete this?

>  	dev->i2s_base = devm_ioremap_resource(&pdev->dev, res);
> -	if (IS_ERR(dev->i2s_base)) {
> -		dev_err(&pdev->dev, "ioremap fail for i2s_region\n");
> +	if (IS_ERR(dev->i2s_base))
>  		return PTR_ERR(dev->i2s_base);
> -	}

or this?
Lars-Peter Clausen Dec. 12, 2014, 9:33 a.m. UTC | #2
On 12/12/2014 10:31 AM, Joe Perches wrote:
[...]
>>   	res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
>> -	if (!res) {
>> -		dev_err(&pdev->dev, "no i2s resource defined\n");
>> -		return -ENODEV;
>> -	}
>> -
>
> Why delete this?
>
>>   	dev->i2s_base = devm_ioremap_resource(&pdev->dev, res);
>> -	if (IS_ERR(dev->i2s_base)) {
>> -		dev_err(&pdev->dev, "ioremap fail for i2s_region\n");
>> +	if (IS_ERR(dev->i2s_base))
>>   		return PTR_ERR(dev->i2s_base);
>> -	}
>
> or this?

devm_ioremap_resource both checks if res is NULL and does also its own error 
reporting. So the code in the driver is redundant.
Andrew Jackson Dec. 12, 2014, 9:39 a.m. UTC | #3
On 12/12/14 09:31, Joe Perches wrote:
> On Fri, 2014-12-12 at 09:25 +0000, Andrew Jackson wrote:
>> The devm_XXX allocation functions print a message on failure,
>> so additional messages are not required.
> []
>> diff --git a/sound/soc/dwc/designware_i2s.c b/sound/soc/dwc/designware_i2s.c
> []
>> @@ -345,26 +345,17 @@ static int dw_i2s_probe(struct platform_device *pdev)
>>  	}
>>  
>>  	dw_i2s_dai = devm_kzalloc(&pdev->dev, sizeof(*dw_i2s_dai), GFP_KERNEL);
>> -	if (!dw_i2s_dai) {
>> -		dev_err(&pdev->dev, "mem allocation failed for dai driver\n");
>> +	if (!dw_i2s_dai)
>>  		return -ENOMEM;
>> -	}
> 
> ok.
>  
>>  	dw_i2s_dai->ops = &dw_i2s_dai_ops;
>>  	dw_i2s_dai->suspend = dw_i2s_suspend;
>>  	dw_i2s_dai->resume = dw_i2s_resume;
>>  
>>  	res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
>> -	if (!res) {
>> -		dev_err(&pdev->dev, "no i2s resource defined\n");
>> -		return -ENODEV;
>> -	}
>> -
> 
> Why delete this?

Lars-Peter said that it was unnecessary: see <http://lists.infradead.org/pipermail/linux-arm-kernel/2014-December/308416.html>.
> 
>>  	dev->i2s_base = devm_ioremap_resource(&pdev->dev, res);
>> -	if (IS_ERR(dev->i2s_base)) {
>> -		dev_err(&pdev->dev, "ioremap fail for i2s_region\n");
>> +	if (IS_ERR(dev->i2s_base))
>>  		return PTR_ERR(dev->i2s_base);
>> -	}
> 
> or this?

Ditto

	Andrew
Joe Perches Dec. 12, 2014, 10:06 a.m. UTC | #4
On Fri, 2014-12-12 at 09:39 +0000, Andrew Jackson wrote:
> On 12/12/14 09:31, Joe Perches wrote:
> > On Fri, 2014-12-12 at 09:25 +0000, Andrew Jackson wrote:
> >> The devm_XXX allocation functions print a message on failure,
> >> so additional messages are not required.
> > []
> >> diff --git a/sound/soc/dwc/designware_i2s.c b/sound/soc/dwc/designware_i2s.c
> > []
> >> @@ -345,26 +345,17 @@ static int dw_i2s_probe(struct platform_device *pdev)
> >>  	}
> >>  
> >>  	dw_i2s_dai = devm_kzalloc(&pdev->dev, sizeof(*dw_i2s_dai), GFP_KERNEL);
> >> -	if (!dw_i2s_dai) {
> >> -		dev_err(&pdev->dev, "mem allocation failed for dai driver\n");
> >> +	if (!dw_i2s_dai)
> >>  		return -ENOMEM;
> >> -	}
> > 
> > ok.
> >  
> >>  	dw_i2s_dai->ops = &dw_i2s_dai_ops;
> >>  	dw_i2s_dai->suspend = dw_i2s_suspend;
> >>  	dw_i2s_dai->resume = dw_i2s_resume;
> >>  
> >>  	res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
> >> -	if (!res) {
> >> -		dev_err(&pdev->dev, "no i2s resource defined\n");
> >> -		return -ENODEV;
> >> -	}
> >> -
> > 
> > Why delete this?
> 
> Lars-Peter said that it was unnecessary: see <http://lists.infradead.org/pipermail/linux-arm-kernel/2014-December/308416.html>.
> > 
> >>  	dev->i2s_base = devm_ioremap_resource(&pdev->dev, res);
> >> -	if (IS_ERR(dev->i2s_base)) {
> >> -		dev_err(&pdev->dev, "ioremap fail for i2s_region\n");
> >> +	if (IS_ERR(dev->i2s_base))
> >>  		return PTR_ERR(dev->i2s_base);
> >> -	}
> > 
> > or this?
> 
> Ditto

OK, but your commit message doesn't match the changes.

These messages are redundant not what most consider
debugging messages (ie: emitted at KERN_DEBUG).

The 2nd one isn't a devm_<foo> function and the last
one isn't an allocation.
Mark Brown Dec. 12, 2014, 7:29 p.m. UTC | #5
On Fri, Dec 12, 2014 at 09:25:00AM +0000, Andrew Jackson wrote:
> From: Andrew Jackson <Andrew.Jackson@arm.com>
> 
> The devm_XXX allocation functions print a message on failure,
> so additional messages are not required.

Applied, thanks.
diff mbox

Patch

diff --git a/sound/soc/dwc/designware_i2s.c b/sound/soc/dwc/designware_i2s.c
index d202c7c..ef771ea 100644
--- a/sound/soc/dwc/designware_i2s.c
+++ b/sound/soc/dwc/designware_i2s.c
@@ -345,26 +345,17 @@  static int dw_i2s_probe(struct platform_device *pdev)
 	}
 
 	dw_i2s_dai = devm_kzalloc(&pdev->dev, sizeof(*dw_i2s_dai), GFP_KERNEL);
-	if (!dw_i2s_dai) {
-		dev_err(&pdev->dev, "mem allocation failed for dai driver\n");
+	if (!dw_i2s_dai)
 		return -ENOMEM;
-	}
 
 	dw_i2s_dai->ops = &dw_i2s_dai_ops;
 	dw_i2s_dai->suspend = dw_i2s_suspend;
 	dw_i2s_dai->resume = dw_i2s_resume;
 
 	res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
-	if (!res) {
-		dev_err(&pdev->dev, "no i2s resource defined\n");
-		return -ENODEV;
-	}
-
 	dev->i2s_base = devm_ioremap_resource(&pdev->dev, res);
-	if (IS_ERR(dev->i2s_base)) {
-		dev_err(&pdev->dev, "ioremap fail for i2s_region\n");
+	if (IS_ERR(dev->i2s_base))
 		return PTR_ERR(dev->i2s_base);
-	}
 
 	cap = pdata->cap;
 	dev->capability = cap;