diff mbox series

[02/17] ASoC: atmel: fix shadowed variable

Message ID 20210326215927.936377-3-pierre-louis.bossart@linux.intel.com
State Accepted
Commit 86f3c05534bed54342ef6912b9da1d75f6b8d902
Headers show
Series ASoC: remove cppcheck warnings for multiple SOCs | expand

Commit Message

Pierre-Louis Bossart March 26, 2021, 9:59 p.m. UTC
Fix cppcheck warning:

sound/soc/atmel/atmel-classd.c:51:14: style: Local variable 'pwm_type'
shadows outer variable [shadowVariable]
 const char *pwm_type;
             ^
sound/soc/atmel/atmel-classd.c:226:27: note: Shadowed declaration
static const char * const pwm_type[] = {
                          ^
sound/soc/atmel/atmel-classd.c:51:14: note: Shadow variable
 const char *pwm_type;
             ^

Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
---
 sound/soc/atmel/atmel-classd.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

Comments

Codrin Ciubotariu March 29, 2021, 7:38 a.m. UTC | #1
On 26.03.2021 23:59, Pierre-Louis Bossart wrote:
> Fix cppcheck warning:

> 

> sound/soc/atmel/atmel-classd.c:51:14: style: Local variable 'pwm_type'

> shadows outer variable [shadowVariable]

>   const char *pwm_type;

>               ^

> sound/soc/atmel/atmel-classd.c:226:27: note: Shadowed declaration

> static const char * const pwm_type[] = {

>                            ^

> sound/soc/atmel/atmel-classd.c:51:14: note: Shadow variable

>   const char *pwm_type;

>               ^

> 

> Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>


Reviewed-by: Codrin Ciubotariu <codrin.ciubotariu@microchip.com>


Thanks!
diff mbox series

Patch

diff --git a/sound/soc/atmel/atmel-classd.c b/sound/soc/atmel/atmel-classd.c
index b1a28a9382fb..6023369e0f1a 100644
--- a/sound/soc/atmel/atmel-classd.c
+++ b/sound/soc/atmel/atmel-classd.c
@@ -48,7 +48,7 @@  static struct atmel_classd_pdata *atmel_classd_dt_init(struct device *dev)
 {
 	struct device_node *np = dev->of_node;
 	struct atmel_classd_pdata *pdata;
-	const char *pwm_type;
+	const char *pwm_type_s;
 	int ret;
 
 	if (!np) {
@@ -60,8 +60,8 @@  static struct atmel_classd_pdata *atmel_classd_dt_init(struct device *dev)
 	if (!pdata)
 		return ERR_PTR(-ENOMEM);
 
-	ret = of_property_read_string(np, "atmel,pwm-type", &pwm_type);
-	if ((ret == 0) && (strcmp(pwm_type, "diff") == 0))
+	ret = of_property_read_string(np, "atmel,pwm-type", &pwm_type_s);
+	if ((ret == 0) && (strcmp(pwm_type_s, "diff") == 0))
 		pdata->pwm_type = CLASSD_MR_PWMTYP_DIFF;
 	else
 		pdata->pwm_type = CLASSD_MR_PWMTYP_SINGLE;