Skip to contentSkip to conversation

Trivial cleanups

PATCH New Takashi Iwai 1 participant 6 messages May 26, 2015 Sound

lore
Share & tools
lore
#0 lore raw

cover Trivial cleanups

Hi,

here is a series of patches to clean up / fix the issues spotted by sparse.

Takashi

===

Takashi Iwai (5):
ALSA: dummy: make local data static
ALSA: lx6464es: Fix duplicated SSID entries
ALSA: lx6464es: Use NULL for pointers
ALSA: bcd2000: Make local data static
sound: sound_firmware: Fix invalid use of vfs_read()

 sound/drivers/dummy.c         | 14 +++++++-------
 sound/pci/lx6464es/lx6464es.c | 16 ++++++++--------
 sound/sound_firmware.c        |  4 +---
 sound/usb/bcd2000/bcd2000.c   |  2 +-
 4 files changed, 17 insertions(+), 19 deletions(-)
Signature · 1 line
2.4.1
#1 lore raw

PATCH 1/5 ALSA: dummy: make local data static

Add missing prefix to make some local data static.

Spotted by sparse:
sound/drivers/dummy.c:159:20: warning: symbol 'model_emu10k1' was not declared. Should it be static? sound/drivers/dummy.c:165:20: warning: symbol 'model_rme9652' was not declared. Should it be static?
....

---
 sound/drivers/dummy.c | 14 +++++++-------
 1 file changed, 7 insertions(+), 7 deletions(-)
sound/drivers/dummy.c +7 -7
index d11baaf0f0b4..5912f440d30f 100644
@@ -156,13 +156,13 @@ static int emu10k1_playback_constraints(struct snd_pcm_runtime *runtime)
 	return 0;
 }
 
-struct dummy_model model_emu10k1 = {
+static struct dummy_model model_emu10k1 = {
 	.name = "emu10k1",
 	.playback_constraints = emu10k1_playback_constraints,
 	.buffer_bytes_max = 128 * 1024,
 };
 
-struct dummy_model model_rme9652 = {
+static struct dummy_model model_rme9652 = {
 	.name = "rme9652",
 	.buffer_bytes_max = 26 * 64 * 1024,
 	.formats = SNDRV_PCM_FMTBIT_S32_LE,
@@ -172,7 +172,7 @@ struct dummy_model model_rme9652 = {
 	.periods_max = 2,
 };
 
-struct dummy_model model_ice1712 = {
+static struct dummy_model model_ice1712 = {
 	.name = "ice1712",
 	.buffer_bytes_max = 256 * 1024,
 	.formats = SNDRV_PCM_FMTBIT_S32_LE,
@@ -182,7 +182,7 @@ struct dummy_model model_ice1712 = {
 	.periods_max = 1024,
 };
 
-struct dummy_model model_uda1341 = {
+static struct dummy_model model_uda1341 = {
 	.name = "uda1341",
 	.buffer_bytes_max = 16380,
 	.formats = SNDRV_PCM_FMTBIT_S16_LE,
@@ -192,7 +192,7 @@ struct dummy_model model_uda1341 = {
 	.periods_max = 255,
 };
 
-struct dummy_model model_ac97 = {
+static struct dummy_model model_ac97 = {
 	.name = "ac97",
 	.formats = SNDRV_PCM_FMTBIT_S16_LE,
 	.channels_min = 2,
@@ -202,7 +202,7 @@ struct dummy_model model_ac97 = {
 	.rate_max = 48000,
 };
 
-struct dummy_model model_ca0106 = {
+static struct dummy_model model_ca0106 = {
 	.name = "ca0106",
 	.formats = SNDRV_PCM_FMTBIT_S16_LE,
 	.buffer_bytes_max = ((65536-64)*8),
@@ -216,7 +216,7 @@ struct dummy_model model_ca0106 = {
 	.rate_max = 192000,
 };
 
-struct dummy_model *dummy_models[] = {
+static struct dummy_model *dummy_models[] = {
 	&model_emu10k1,
 	&model_rme9652,
 	&model_ice1712,
Signature · 1 line
2.4.1
#2 lore raw

PATCH 2/5 ALSA: lx6464es: Fix duplicated SSID entries

In reply to Takashi Iwai

PCI_DEVICE() macro itself defines SSID entries while we override them after that. Replace with a more appropriate macro, PCI_DEVICE_SUB() to define all ID values properly.

Spotted by sparse:
sound/pci/lx6464es/lx6464es.c:60:11: warning: Initializer entry defined twice
sound/pci/lx6464es/lx6464es.c:61:12: also defined here
sound/pci/lx6464es/lx6464es.c:64:11: warning: Initializer entry defined twice
sound/pci/lx6464es/lx6464es.c:65:12: also defined here

---
 sound/pci/lx6464es/lx6464es.c | 12 ++++++------
 1 file changed, 6 insertions(+), 6 deletions(-)
sound/pci/lx6464es/lx6464es.c +6 -6
index 32c6f6ba1442..611b9a88784e 100644
@@ -57,13 +57,13 @@ static const char card_name[] = "LX6464ES";
 #define PCI_DEVICE_ID_PLX_LX6464ES		PCI_DEVICE_ID_PLX_9056
 
 static const struct pci_device_id snd_lx6464es_ids[] = {
-	{ PCI_DEVICE(PCI_VENDOR_ID_PLX, PCI_DEVICE_ID_PLX_LX6464ES),
-	  .subvendor = PCI_VENDOR_ID_DIGIGRAM,
-	  .subdevice = PCI_SUBDEVICE_ID_DIGIGRAM_LX6464ES_SERIAL_SUBSYSTEM
+	{ PCI_DEVICE_SUB(PCI_VENDOR_ID_PLX, PCI_DEVICE_ID_PLX_LX6464ES,
+			 PCI_VENDOR_ID_DIGIGRAM,
+			 PCI_SUBDEVICE_ID_DIGIGRAM_LX6464ES_SERIAL_SUBSYSTEM),
 	},			/* LX6464ES */
-	{ PCI_DEVICE(PCI_VENDOR_ID_PLX, PCI_DEVICE_ID_PLX_LX6464ES),
-	  .subvendor = PCI_VENDOR_ID_DIGIGRAM,
-	  .subdevice = PCI_SUBDEVICE_ID_DIGIGRAM_LX6464ES_CAE_SERIAL_SUBSYSTEM
+	{ PCI_DEVICE_SUB(PCI_VENDOR_ID_PLX, PCI_DEVICE_ID_PLX_LX6464ES,
+			 PCI_VENDOR_ID_DIGIGRAM,
+			 PCI_SUBDEVICE_ID_DIGIGRAM_LX6464ES_CAE_SERIAL_SUBSYSTEM),
 	},			/* LX6464ES-CAE */
 	{ 0, },
 };
Signature · 1 line
2.4.1
#3 lore raw

PATCH 3/5 ALSA: lx6464es: Use NULL for pointers

In reply to Takashi Iwai

Spotted by sparse:
sound/pci/lx6464es/lx6464es.c:415:47: warning: Using plain integer as NULL pointer sound/pci/lx6464es/lx6464es.c:417:48: warning: Using plain integer as NULL pointer

---
 sound/pci/lx6464es/lx6464es.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
sound/pci/lx6464es/lx6464es.c +2 -2
index 611b9a88784e..cba89beb2b38 100644
@@ -412,9 +412,9 @@ static int lx_pcm_hw_free(struct snd_pcm_substream *substream)
 	err = snd_pcm_lib_free_pages(substream);
 
 	if (is_capture)
-		chip->capture_stream.stream = 0;
+		chip->capture_stream.stream = NULL;
 	else
-		chip->playback_stream.stream = 0;
+		chip->playback_stream.stream = NULL;
 
 exit:
 	mutex_unlock(&chip->setup_mutex);
Signature · 1 line
2.4.1
#4 lore raw

PATCH 4/5 ALSA: bcd2000: Make local data static

In reply to Takashi Iwai

Spotted by sparse:
sound/usb/bcd2000/bcd2000.c:73:1: warning: symbol 'devices_used' was not declared. Should it be static?

---
 sound/usb/bcd2000/bcd2000.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
sound/usb/bcd2000/bcd2000.c +1 -1
index 820d6ca8c458..d060dddcc52d 100644
@@ -70,7 +70,7 @@ static int index[SNDRV_CARDS] = SNDRV_DEFAULT_IDX;
 static char *id[SNDRV_CARDS] = SNDRV_DEFAULT_STR;
 
 static DEFINE_MUTEX(devices_mutex);
-DECLARE_BITMAP(devices_used, SNDRV_CARDS);
+static DECLARE_BITMAP(devices_used, SNDRV_CARDS);
 static struct usb_driver bcd2000_driver;
 
 #ifdef CONFIG_SND_DEBUG
Signature · 1 line
2.4.1
#5 lore raw

PATCH 5/5 sound: sound_firmware: Fix invalid use of vfs_read()

In reply to Takashi Iwai

It should use kernel_read() instead of vfs_read() to load a firmware binary onto the kernel pages.

---
 sound/sound_firmware.c | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)
sound/sound_firmware.c +1 -3
index b155137ee312..026347643c81 100644
@@ -12,7 +12,6 @@ static int do_mod_firmware_load(const char *fn, char **fp)
 	struct file* filp;
 	long l;
 	char *dp;
-	loff_t pos;
 
 	filp = filp_open(fn, 0, 0);
 	if (IS_ERR(filp))
@@ -34,8 +33,7 @@ static int do_mod_firmware_load(const char *fn, char **fp)
 		fput(filp);
 		return 0;
 	}
-	pos = 0;
-	if (vfs_read(filp, dp, l, &pos) != l)
+	if (kernel_read(filp, 0, dp, l) != l)
 	{
 		printk(KERN_INFO "Failed to read '%s'.\n", fn);
 		vfree(dp);
Signature · 1 line
2.4.1