Skip to contentSkip to conversation

ASoC: Intel: fix compiler warning of function ‘probe_codec’

-next Wang Yufen 2 participants 2 messages Sep 13, 2022

Subsystems (3)
lore
Share & tools
lore

Wang Yufen

author
#0 lore raw

Move the variable ‘skl’ define to CONFIG_SND_SOC_INTEL_SKYLAKE_HDAUDIO_CODEC enabled, to fix the compiler warning:
sound/soc/intel/skylake/skl.c: In function ‘probe_codec’:
sound/soc/intel/skylake/skl.c:729:18: warning: unused variable ‘skl’ [-Wunused-variable]

    729 |  struct skl_dev *skl = bus_to_skl(bus);
        |                  ^~~
---
 sound/soc/intel/skylake/skl.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
sound/soc/intel/skylake/skl.c +1 -1
index c7c1cad..52a041d 100644
@@ -726,8 +726,8 @@ static int probe_codec(struct hdac_bus *bus, int addr)
 	unsigned int cmd = (addr << 28) | (AC_NODE_ROOT << 20) |
 		(AC_VERB_PARAMETERS << 8) | AC_PAR_VENDOR_ID;
 	unsigned int res = -1;
-	struct skl_dev *skl = bus_to_skl(bus);
 #if IS_ENABLED(CONFIG_SND_SOC_INTEL_SKYLAKE_HDAUDIO_CODEC)
+	struct skl_dev *skl = bus_to_skl(bus);
 	struct hdac_hda_priv *hda_codec;
 #endif
 	struct hda_codec *codec;
Signature · 1 line
1.8.3.1
maintainer
#1 lore raw
Quoted 9 lines · Wang Yufen

Move the variable ‘skl’ define to
CONFIG_SND_SOC_INTEL_SKYLAKE_HDAUDIO_CODEC enabled, to fix the compiler warning:
sound/soc/intel/skylake/skl.c: In function ‘probe_codec’:
sound/soc/intel/skylake/skl.c:729:18: warning: unused variable ‘skl’ [-Wunused-variable]

     729 |  struct skl_dev *skl = bus_to_skl(bus);
         |                  ^~~

Fix is fine but it has been proposed already by Gaosheng [1].

[1]: https://lore.kernel.org/alsa-devel/[email protected]/

Regards,
Czarek

Quoted 18 lines
---
  sound/soc/intel/skylake/skl.c | 2 +-
  1 file changed, 1 insertion(+), 1 deletion(-)
sound/soc/intel/skylake/skl.c +1 -1
index c7c1cad..52a041d 100644
@@ -726,8 +726,8 @@ static int probe_codec(struct hdac_bus *bus, int addr)
  	unsigned int cmd = (addr << 28) | (AC_NODE_ROOT << 20) |
  		(AC_VERB_PARAMETERS << 8) | AC_PAR_VENDOR_ID;
  	unsigned int res = -1;
-	struct skl_dev *skl = bus_to_skl(bus);
  #if IS_ENABLED(CONFIG_SND_SOC_INTEL_SKYLAKE_HDAUDIO_CODEC)
+	struct skl_dev *skl = bus_to_skl(bus);
  	struct hdac_hda_priv *hda_codec;
  #endif
  	struct hda_codec *codec;