[alsa-devel] [PATCH 0/5] 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(-)
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? ....
Signed-off-by: Takashi Iwai tiwai@suse.de --- sound/drivers/dummy.c | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-)
diff --git a/sound/drivers/dummy.c b/sound/drivers/dummy.c index d11baaf0f0b4..5912f440d30f 100644 --- a/sound/drivers/dummy.c +++ b/sound/drivers/dummy.c @@ -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,
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
Signed-off-by: Takashi Iwai tiwai@suse.de --- sound/pci/lx6464es/lx6464es.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-)
diff --git a/sound/pci/lx6464es/lx6464es.c b/sound/pci/lx6464es/lx6464es.c index 32c6f6ba1442..611b9a88784e 100644 --- a/sound/pci/lx6464es/lx6464es.c +++ b/sound/pci/lx6464es/lx6464es.c @@ -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, }, };
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
Signed-off-by: Takashi Iwai tiwai@suse.de --- sound/pci/lx6464es/lx6464es.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/sound/pci/lx6464es/lx6464es.c b/sound/pci/lx6464es/lx6464es.c index 611b9a88784e..cba89beb2b38 100644 --- a/sound/pci/lx6464es/lx6464es.c +++ b/sound/pci/lx6464es/lx6464es.c @@ -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);
Spotted by sparse: sound/usb/bcd2000/bcd2000.c:73:1: warning: symbol 'devices_used' was not declared. Should it be static?
Signed-off-by: Takashi Iwai tiwai@suse.de --- sound/usb/bcd2000/bcd2000.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/sound/usb/bcd2000/bcd2000.c b/sound/usb/bcd2000/bcd2000.c index 820d6ca8c458..d060dddcc52d 100644 --- a/sound/usb/bcd2000/bcd2000.c +++ b/sound/usb/bcd2000/bcd2000.c @@ -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
It should use kernel_read() instead of vfs_read() to load a firmware binary onto the kernel pages.
Signed-off-by: Takashi Iwai tiwai@suse.de --- sound/sound_firmware.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-)
diff --git a/sound/sound_firmware.c b/sound/sound_firmware.c index b155137ee312..026347643c81 100644 --- a/sound/sound_firmware.c +++ b/sound/sound_firmware.c @@ -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);
participants (1)
-
Takashi Iwai