186-ASoC-atmel-fix-shadowed-variable.patch 1.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748
  1. From 1b41c69264d7233a3e9a0aa36333ee22a5a049e9 Mon Sep 17 00:00:00 2001
  2. From: Pierre-Louis Bossart <[email protected]>
  3. Date: Fri, 26 Mar 2021 16:59:12 -0500
  4. Subject: [PATCH 186/247] ASoC: atmel: fix shadowed variable
  5. Fix cppcheck warning:
  6. sound/soc/atmel/atmel-classd.c:51:14: style: Local variable 'pwm_type'
  7. shadows outer variable [shadowVariable]
  8. const char *pwm_type;
  9. ^
  10. sound/soc/atmel/atmel-classd.c:226:27: note: Shadowed declaration
  11. static const char * const pwm_type[] = {
  12. ^
  13. sound/soc/atmel/atmel-classd.c:51:14: note: Shadow variable
  14. const char *pwm_type;
  15. ^
  16. Signed-off-by: Pierre-Louis Bossart <[email protected]>
  17. Reviewed-by: Codrin Ciubotariu <[email protected]>
  18. Link: https://lore.kernel.org/r/[email protected]
  19. Signed-off-by: Mark Brown <[email protected]>
  20. ---
  21. sound/soc/atmel/atmel-classd.c | 6 +++---
  22. 1 file changed, 3 insertions(+), 3 deletions(-)
  23. --- a/sound/soc/atmel/atmel-classd.c
  24. +++ b/sound/soc/atmel/atmel-classd.c
  25. @@ -48,7 +48,7 @@ static struct atmel_classd_pdata *atmel_
  26. {
  27. struct device_node *np = dev->of_node;
  28. struct atmel_classd_pdata *pdata;
  29. - const char *pwm_type;
  30. + const char *pwm_type_s;
  31. int ret;
  32. if (!np) {
  33. @@ -60,8 +60,8 @@ static struct atmel_classd_pdata *atmel_
  34. if (!pdata)
  35. return ERR_PTR(-ENOMEM);
  36. - ret = of_property_read_string(np, "atmel,pwm-type", &pwm_type);
  37. - if ((ret == 0) && (strcmp(pwm_type, "diff") == 0))
  38. + ret = of_property_read_string(np, "atmel,pwm-type", &pwm_type_s);
  39. + if ((ret == 0) && (strcmp(pwm_type_s, "diff") == 0))
  40. pdata->pwm_type = CLASSD_MR_PWMTYP_DIFF;
  41. else
  42. pdata->pwm_type = CLASSD_MR_PWMTYP_SINGLE;