[alsa-devel] [PATCH 1/5] ALSA: hda: Remove unused variable
'status' is not used in the function. Remove it.
Signed-off-by: Sachin Kamat sachin.kamat@samsung.com Cc: Stephen Warren swarren@wwwdotorg.org Cc: Thierry Reding thierry.reding@gmail.com --- All patches in this series only compile tested. --- sound/pci/hda/hda_tegra.c | 4 ---- 1 file changed, 4 deletions(-)
diff --git a/sound/pci/hda/hda_tegra.c b/sound/pci/hda/hda_tegra.c index a366ba9293a8..8cd7b06eecef 100644 --- a/sound/pci/hda/hda_tegra.c +++ b/sound/pci/hda/hda_tegra.c @@ -272,13 +272,9 @@ static int hda_tegra_resume(struct device *dev) struct snd_card *card = dev_get_drvdata(dev); struct azx *chip = card->private_data; struct hda_tegra *hda = container_of(chip, struct hda_tegra, chip); - int status;
hda_tegra_enable_clocks(hda);
- /* Read STATESTS before controller reset */ - status = azx_readw(chip, STATESTS); - hda_tegra_init(hda);
azx_init_chip(chip, 1);
Removed the code which is not used in the functions.
Signed-off-by: Sachin Kamat sachin.kamat@samsung.com --- sound/pci/rme9652/hdspm.c | 23 +++-------------------- 1 file changed, 3 insertions(+), 20 deletions(-)
diff --git a/sound/pci/rme9652/hdspm.c b/sound/pci/rme9652/hdspm.c index cb82b593473a..60ee41fda5d1 100644 --- a/sound/pci/rme9652/hdspm.c +++ b/sound/pci/rme9652/hdspm.c @@ -1257,14 +1257,13 @@ static int hdspm_rate_multiplier(struct hdspm *hdspm, int rate) /* check for external sample rate, returns the sample rate in Hz*/ static int hdspm_external_sample_rate(struct hdspm *hdspm) { - unsigned int status, status2, timecode; + unsigned int status, status2; int syncref, rate = 0, rate_bits;
switch (hdspm->io_type) { case AES32: status2 = hdspm_read(hdspm, HDSPM_statusRegister2); status = hdspm_read(hdspm, HDSPM_statusRegister); - timecode = hdspm_read(hdspm, HDSPM_timecodeRegister);
syncref = hdspm_autosync_ref(hdspm); switch (syncref) { @@ -4873,18 +4872,15 @@ snd_hdspm_proc_read_madi(struct snd_info_entry *entry, struct snd_info_buffer *buffer) { struct hdspm *hdspm = entry->private_data; - unsigned int status, status2, control, freq; + unsigned int status, status2;
char *pref_sync_ref; char *autosync_ref; char *system_clock_mode; - char *insel; int x, x2;
status = hdspm_read(hdspm, HDSPM_statusRegister); status2 = hdspm_read(hdspm, HDSPM_statusRegister2); - control = hdspm->control_register; - freq = hdspm_read(hdspm, HDSPM_timecodeRegister);
snd_iprintf(buffer, "%s (Card #%d) Rev.%x Status2first3bits: %x\n", hdspm->card_name, hdspm->card->number + 1, @@ -4947,17 +4943,6 @@ snd_hdspm_proc_read_madi(struct snd_info_entry *entry, snd_iprintf(buffer, "Line out: %s\n", (hdspm->control_register & HDSPM_LineOut) ? "on " : "off");
- switch (hdspm->control_register & HDSPM_InputMask) { - case HDSPM_InputOptical: - insel = "Optical"; - break; - case HDSPM_InputCoaxial: - insel = "Coaxial"; - break; - default: - insel = "Unknown"; - } - snd_iprintf(buffer, "ClearTrackMarker = %s, Transmit in %s Channel Mode, " "Auto Input %s\n", @@ -5202,15 +5187,13 @@ snd_hdspm_proc_read_raydat(struct snd_info_entry *entry, struct snd_info_buffer *buffer) { struct hdspm *hdspm = entry->private_data; - unsigned int status1, status2, status3, control, i; + unsigned int status1, status2, status3, i; unsigned int lock, sync;
status1 = hdspm_read(hdspm, HDSPM_RD_STATUS_1); /* s1 */ status2 = hdspm_read(hdspm, HDSPM_RD_STATUS_2); /* freq */ status3 = hdspm_read(hdspm, HDSPM_RD_STATUS_3); /* s2 */
- control = hdspm->control_register; - snd_iprintf(buffer, "STATUS1: 0x%08x\n", status1); snd_iprintf(buffer, "STATUS2: 0x%08x\n", status2); snd_iprintf(buffer, "STATUS3: 0x%08x\n", status3);
At Tue, 1 Jul 2014 17:02:55 +0530, Sachin Kamat wrote:
Removed the code which is not used in the functions.
Again, this also changes the hardware access pattern, so I'd take only if it's tested.
thanks,
Takashi
Signed-off-by: Sachin Kamat sachin.kamat@samsung.com
sound/pci/rme9652/hdspm.c | 23 +++-------------------- 1 file changed, 3 insertions(+), 20 deletions(-)
diff --git a/sound/pci/rme9652/hdspm.c b/sound/pci/rme9652/hdspm.c index cb82b593473a..60ee41fda5d1 100644 --- a/sound/pci/rme9652/hdspm.c +++ b/sound/pci/rme9652/hdspm.c @@ -1257,14 +1257,13 @@ static int hdspm_rate_multiplier(struct hdspm *hdspm, int rate) /* check for external sample rate, returns the sample rate in Hz*/ static int hdspm_external_sample_rate(struct hdspm *hdspm) {
- unsigned int status, status2, timecode;
unsigned int status, status2; int syncref, rate = 0, rate_bits;
switch (hdspm->io_type) { case AES32: status2 = hdspm_read(hdspm, HDSPM_statusRegister2); status = hdspm_read(hdspm, HDSPM_statusRegister);
timecode = hdspm_read(hdspm, HDSPM_timecodeRegister);
syncref = hdspm_autosync_ref(hdspm); switch (syncref) {
@@ -4873,18 +4872,15 @@ snd_hdspm_proc_read_madi(struct snd_info_entry *entry, struct snd_info_buffer *buffer) { struct hdspm *hdspm = entry->private_data;
- unsigned int status, status2, control, freq;
unsigned int status, status2;
char *pref_sync_ref; char *autosync_ref; char *system_clock_mode;
char *insel; int x, x2;
status = hdspm_read(hdspm, HDSPM_statusRegister); status2 = hdspm_read(hdspm, HDSPM_statusRegister2);
control = hdspm->control_register;
freq = hdspm_read(hdspm, HDSPM_timecodeRegister);
snd_iprintf(buffer, "%s (Card #%d) Rev.%x Status2first3bits: %x\n", hdspm->card_name, hdspm->card->number + 1,
@@ -4947,17 +4943,6 @@ snd_hdspm_proc_read_madi(struct snd_info_entry *entry, snd_iprintf(buffer, "Line out: %s\n", (hdspm->control_register & HDSPM_LineOut) ? "on " : "off");
- switch (hdspm->control_register & HDSPM_InputMask) {
- case HDSPM_InputOptical:
insel = "Optical";
break;
- case HDSPM_InputCoaxial:
insel = "Coaxial";
break;
- default:
insel = "Unknown";
- }
- snd_iprintf(buffer, "ClearTrackMarker = %s, Transmit in %s Channel Mode, " "Auto Input %s\n",
@@ -5202,15 +5187,13 @@ snd_hdspm_proc_read_raydat(struct snd_info_entry *entry, struct snd_info_buffer *buffer) { struct hdspm *hdspm = entry->private_data;
- unsigned int status1, status2, status3, control, i;
unsigned int status1, status2, status3, i; unsigned int lock, sync;
status1 = hdspm_read(hdspm, HDSPM_RD_STATUS_1); /* s1 */ status2 = hdspm_read(hdspm, HDSPM_RD_STATUS_2); /* freq */ status3 = hdspm_read(hdspm, HDSPM_RD_STATUS_3); /* s2 */
- control = hdspm->control_register;
- snd_iprintf(buffer, "STATUS1: 0x%08x\n", status1); snd_iprintf(buffer, "STATUS2: 0x%08x\n", status2); snd_iprintf(buffer, "STATUS3: 0x%08x\n", status3);
-- 1.7.9.5
'err' is not used in the function. Remove it.
Signed-off-by: Sachin Kamat sachin.kamat@samsung.com --- sound/pci/ice1712/revo.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-)
diff --git a/sound/pci/ice1712/revo.c b/sound/pci/ice1712/revo.c index 1112ec1953be..0168aaa5f58c 100644 --- a/sound/pci/ice1712/revo.c +++ b/sound/pci/ice1712/revo.c @@ -481,7 +481,6 @@ static int ap192_ak4114_init(struct snd_ice1712 *ice) static const unsigned char ak4114_init_txcsb[] = { 0x41, 0x02, 0x2c, 0x00, 0x00 }; - int err;
struct revo51_spec *spec; spec = kzalloc(sizeof(*spec), GFP_KERNEL); @@ -489,7 +488,7 @@ static int ap192_ak4114_init(struct snd_ice1712 *ice) return -ENOMEM; ice->spec = spec;
- err = snd_ak4114_create(ice->card, + snd_ak4114_create(ice->card, ap192_ak4114_read, ap192_ak4114_write, ak4114_init_vals, ak4114_init_txcsb,
At Tue, 1 Jul 2014 17:02:56 +0530, Sachin Kamat wrote:
'err' is not used in the function. Remove it.
Better to handle the error case than ignoring it.
thanks,
Takashi
Signed-off-by: Sachin Kamat sachin.kamat@samsung.com
sound/pci/ice1712/revo.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-)
diff --git a/sound/pci/ice1712/revo.c b/sound/pci/ice1712/revo.c index 1112ec1953be..0168aaa5f58c 100644 --- a/sound/pci/ice1712/revo.c +++ b/sound/pci/ice1712/revo.c @@ -481,7 +481,6 @@ static int ap192_ak4114_init(struct snd_ice1712 *ice) static const unsigned char ak4114_init_txcsb[] = { 0x41, 0x02, 0x2c, 0x00, 0x00 };
int err;
struct revo51_spec *spec; spec = kzalloc(sizeof(*spec), GFP_KERNEL);
@@ -489,7 +488,7 @@ static int ap192_ak4114_init(struct snd_ice1712 *ice) return -ENOMEM; ice->spec = spec;
- err = snd_ak4114_create(ice->card,
- snd_ak4114_create(ice->card, ap192_ak4114_read, ap192_ak4114_write, ak4114_init_vals, ak4114_init_txcsb,
-- 1.7.9.5
On Tue, Jul 1, 2014 at 5:27 PM, Takashi Iwai tiwai@suse.de wrote:
At Tue, 1 Jul 2014 17:02:56 +0530, Sachin Kamat wrote:
'err' is not used in the function. Remove it.
Better to handle the error case than ignoring it.
A comment below the code says "/* error ignored; it's no fatal error */"
Hence, I removed it.
Regards, Sachin.
At Tue, 1 Jul 2014 17:30:22 +0530, Sachin Kamat wrote:
On Tue, Jul 1, 2014 at 5:27 PM, Takashi Iwai tiwai@suse.de wrote:
At Tue, 1 Jul 2014 17:02:56 +0530, Sachin Kamat wrote:
'err' is not used in the function. Remove it.
Better to handle the error case than ignoring it.
A comment below the code says "/* error ignored; it's no fatal error */"
Hence, I removed it.
The comment is wrong, then :) If kmalloc for such a size fails, it's usually in a very bad situation.
Takashi
'chip' is not used in the function. Remove it.
Signed-off-by: Sachin Kamat sachin.kamat@samsung.com --- sound/pci/echoaudio/echoaudio.c | 6 ------ 1 file changed, 6 deletions(-)
diff --git a/sound/pci/echoaudio/echoaudio.c b/sound/pci/echoaudio/echoaudio.c index 9f10c9e0df5e..631aaa4046ad 100644 --- a/sound/pci/echoaudio/echoaudio.c +++ b/sound/pci/echoaudio/echoaudio.c @@ -1754,9 +1754,6 @@ static struct snd_kcontrol_new snd_echo_vumeters_switch = { static int snd_echo_vumeters_info(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_info *uinfo) { - struct echoaudio *chip; - - chip = snd_kcontrol_chip(kcontrol); uinfo->type = SNDRV_CTL_ELEM_TYPE_INTEGER; uinfo->count = 96; uinfo->value.integer.min = ECHOGAIN_MINOUT; @@ -1798,9 +1795,6 @@ static struct snd_kcontrol_new snd_echo_vumeters = { static int snd_echo_channels_info_info(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_info *uinfo) { - struct echoaudio *chip; - - chip = snd_kcontrol_chip(kcontrol); uinfo->type = SNDRV_CTL_ELEM_TYPE_INTEGER; uinfo->count = 6; uinfo->value.integer.min = 0;
At Tue, 1 Jul 2014 17:02:57 +0530, Sachin Kamat wrote:
'chip' is not used in the function. Remove it.
Signed-off-by: Sachin Kamat sachin.kamat@samsung.com
Applied, thanks.
Takashi
sound/pci/echoaudio/echoaudio.c | 6 ------ 1 file changed, 6 deletions(-)
diff --git a/sound/pci/echoaudio/echoaudio.c b/sound/pci/echoaudio/echoaudio.c index 9f10c9e0df5e..631aaa4046ad 100644 --- a/sound/pci/echoaudio/echoaudio.c +++ b/sound/pci/echoaudio/echoaudio.c @@ -1754,9 +1754,6 @@ static struct snd_kcontrol_new snd_echo_vumeters_switch = { static int snd_echo_vumeters_info(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_info *uinfo) {
- struct echoaudio *chip;
- chip = snd_kcontrol_chip(kcontrol); uinfo->type = SNDRV_CTL_ELEM_TYPE_INTEGER; uinfo->count = 96; uinfo->value.integer.min = ECHOGAIN_MINOUT;
@@ -1798,9 +1795,6 @@ static struct snd_kcontrol_new snd_echo_vumeters = { static int snd_echo_channels_info_info(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_info *uinfo) {
- struct echoaudio *chip;
- chip = snd_kcontrol_chip(kcontrol); uinfo->type = SNDRV_CTL_ELEM_TYPE_INTEGER; uinfo->count = 6; uinfo->value.integer.min = 0;
-- 1.7.9.5
'err' is not used in the function. Remove it.
Signed-off-by: Sachin Kamat sachin.kamat@samsung.com --- sound/pci/mixart/mixart_core.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-)
diff --git a/sound/pci/mixart/mixart_core.c b/sound/pci/mixart/mixart_core.c index 71f4bdcc4055..84f67450924e 100644 --- a/sound/pci/mixart/mixart_core.c +++ b/sound/pci/mixart/mixart_core.c @@ -151,13 +151,11 @@ static int send_msg( struct mixart_mgr *mgr, { u32 headptr, tailptr; u32 msg_frame_address; - int err, i; + int i;
if (snd_BUG_ON(msg->size % 4)) return -EINVAL;
- err = 0; - /* get message frame address */ tailptr = readl_be(MIXART_MEM(mgr, MSG_INBOUND_FREE_TAIL)); headptr = readl_be(MIXART_MEM(mgr, MSG_INBOUND_FREE_HEAD));
At Tue, 1 Jul 2014 17:02:58 +0530, Sachin Kamat wrote:
'err' is not used in the function. Remove it.
Signed-off-by: Sachin Kamat sachin.kamat@samsung.com
Applied, thanks.
Takashi
sound/pci/mixart/mixart_core.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-)
diff --git a/sound/pci/mixart/mixart_core.c b/sound/pci/mixart/mixart_core.c index 71f4bdcc4055..84f67450924e 100644 --- a/sound/pci/mixart/mixart_core.c +++ b/sound/pci/mixart/mixart_core.c @@ -151,13 +151,11 @@ static int send_msg( struct mixart_mgr *mgr, { u32 headptr, tailptr; u32 msg_frame_address;
- int err, i;
int i;
if (snd_BUG_ON(msg->size % 4)) return -EINVAL;
- err = 0;
- /* get message frame address */ tailptr = readl_be(MIXART_MEM(mgr, MSG_INBOUND_FREE_TAIL)); headptr = readl_be(MIXART_MEM(mgr, MSG_INBOUND_FREE_HEAD));
-- 1.7.9.5
At Tue, 1 Jul 2014 17:02:54 +0530, Sachin Kamat wrote:
'status' is not used in the function. Remove it.
Signed-off-by: Sachin Kamat sachin.kamat@samsung.com Cc: Stephen Warren swarren@wwwdotorg.org Cc: Thierry Reding thierry.reding@gmail.com
All patches in this series only compile tested.
Removing such a line is unsafe, thus it must be tested. It changes the hardware access pattern and sometimes the read is intentionally there although the value isn't used.
That said, without testing, I won't apply such patches.
thanks,
Takashi
sound/pci/hda/hda_tegra.c | 4 ---- 1 file changed, 4 deletions(-)
diff --git a/sound/pci/hda/hda_tegra.c b/sound/pci/hda/hda_tegra.c index a366ba9293a8..8cd7b06eecef 100644 --- a/sound/pci/hda/hda_tegra.c +++ b/sound/pci/hda/hda_tegra.c @@ -272,13 +272,9 @@ static int hda_tegra_resume(struct device *dev) struct snd_card *card = dev_get_drvdata(dev); struct azx *chip = card->private_data; struct hda_tegra *hda = container_of(chip, struct hda_tegra, chip);
int status;
hda_tegra_enable_clocks(hda);
/* Read STATESTS before controller reset */
status = azx_readw(chip, STATESTS);
hda_tegra_init(hda);
azx_init_chip(chip, 1);
-- 1.7.9.5
On Tue, Jul 1, 2014 at 5:26 PM, Takashi Iwai tiwai@suse.de wrote:
At Tue, 1 Jul 2014 17:02:54 +0530, Sachin Kamat wrote:
'status' is not used in the function. Remove it.
Signed-off-by: Sachin Kamat sachin.kamat@samsung.com Cc: Stephen Warren swarren@wwwdotorg.org Cc: Thierry Reding thierry.reding@gmail.com
All patches in this series only compile tested.
Removing such a line is unsafe, thus it must be tested. It changes the hardware access pattern and sometimes the read is intentionally there although the value isn't used.
That said, without testing, I won't apply such patches.
Right. I understand. That is the reason I explicitly mentioned that patches are untested. However, in the above cases how about removing the local variable (return value) and just keeping the read/write calls?
Regards, Sachin.
At Tue, 1 Jul 2014 17:33:25 +0530, Sachin Kamat wrote:
On Tue, Jul 1, 2014 at 5:26 PM, Takashi Iwai tiwai@suse.de wrote:
At Tue, 1 Jul 2014 17:02:54 +0530, Sachin Kamat wrote:
'status' is not used in the function. Remove it.
Signed-off-by: Sachin Kamat sachin.kamat@samsung.com Cc: Stephen Warren swarren@wwwdotorg.org Cc: Thierry Reding thierry.reding@gmail.com
All patches in this series only compile tested.
Removing such a line is unsafe, thus it must be tested. It changes the hardware access pattern and sometimes the read is intentionally there although the value isn't used.
That said, without testing, I won't apply such patches.
Right. I understand. That is the reason I explicitly mentioned that patches are untested. However, in the above cases how about removing the local variable (return value) and just keeping the read/write calls?
If the call is needed, yes, at best with some comments. But until someone really tests that it's unnecessary, there is no big reason to touch the code.
Takashi
On 07/01/2014 05:32 AM, Sachin Kamat wrote:
'status' is not used in the function. Remove it.
CCing Dylan Reid for comments/testing since he wrote or upstreamed this code.
Signed-off-by: Sachin Kamat sachin.kamat@samsung.com Cc: Stephen Warren swarren@wwwdotorg.org Cc: Thierry Reding thierry.reding@gmail.com
All patches in this series only compile tested.
sound/pci/hda/hda_tegra.c | 4 ---- 1 file changed, 4 deletions(-)
diff --git a/sound/pci/hda/hda_tegra.c b/sound/pci/hda/hda_tegra.c index a366ba9293a8..8cd7b06eecef 100644 --- a/sound/pci/hda/hda_tegra.c +++ b/sound/pci/hda/hda_tegra.c @@ -272,13 +272,9 @@ static int hda_tegra_resume(struct device *dev) struct snd_card *card = dev_get_drvdata(dev); struct azx *chip = card->private_data; struct hda_tegra *hda = container_of(chip, struct hda_tegra, chip);
int status;
hda_tegra_enable_clocks(hda);
/* Read STATESTS before controller reset */
status = azx_readw(chip, STATESTS);
hda_tegra_init(hda);
azx_init_chip(chip, 1);
On Tue, Jul 1, 2014 at 8:07 AM, Stephen Warren swarren@wwwdotorg.org wrote:
On 07/01/2014 05:32 AM, Sachin Kamat wrote:
'status' is not used in the function. Remove it.
CCing Dylan Reid for comments/testing since he wrote or upstreamed this code.
Thanks, I gave this a try on a couple of systems this morning. HDMI audio still works through suspend/resume cycles.
Signed-off-by: Sachin Kamat sachin.kamat@samsung.com Cc: Stephen Warren swarren@wwwdotorg.org
Tested-by: Dylan Reid dgreid@chromium.org
Cc: Thierry Reding thierry.reding@gmail.com
All patches in this series only compile tested.
sound/pci/hda/hda_tegra.c | 4 ---- 1 file changed, 4 deletions(-)
diff --git a/sound/pci/hda/hda_tegra.c b/sound/pci/hda/hda_tegra.c index a366ba9293a8..8cd7b06eecef 100644 --- a/sound/pci/hda/hda_tegra.c +++ b/sound/pci/hda/hda_tegra.c @@ -272,13 +272,9 @@ static int hda_tegra_resume(struct device *dev) struct snd_card *card = dev_get_drvdata(dev); struct azx *chip = card->private_data; struct hda_tegra *hda = container_of(chip, struct hda_tegra, chip);
int status; hda_tegra_enable_clocks(hda);
/* Read STATESTS before controller reset */
status = azx_readw(chip, STATESTS);
hda_tegra_init(hda); azx_init_chip(chip, 1);
At Tue, 1 Jul 2014 08:47:39 -0700, Dylan Reid wrote:
On Tue, Jul 1, 2014 at 8:07 AM, Stephen Warren swarren@wwwdotorg.org wrote:
On 07/01/2014 05:32 AM, Sachin Kamat wrote:
'status' is not used in the function. Remove it.
CCing Dylan Reid for comments/testing since he wrote or upstreamed this code.
Thanks, I gave this a try on a couple of systems this morning. HDMI audio still works through suspend/resume cycles.
Signed-off-by: Sachin Kamat sachin.kamat@samsung.com Cc: Stephen Warren swarren@wwwdotorg.org
Tested-by: Dylan Reid dgreid@chromium.org
Great, I applied the patch now. Thanks!
Takashi
Cc: Thierry Reding thierry.reding@gmail.com
All patches in this series only compile tested.
sound/pci/hda/hda_tegra.c | 4 ---- 1 file changed, 4 deletions(-)
diff --git a/sound/pci/hda/hda_tegra.c b/sound/pci/hda/hda_tegra.c index a366ba9293a8..8cd7b06eecef 100644 --- a/sound/pci/hda/hda_tegra.c +++ b/sound/pci/hda/hda_tegra.c @@ -272,13 +272,9 @@ static int hda_tegra_resume(struct device *dev) struct snd_card *card = dev_get_drvdata(dev); struct azx *chip = card->private_data; struct hda_tegra *hda = container_of(chip, struct hda_tegra, chip);
int status; hda_tegra_enable_clocks(hda);
/* Read STATESTS before controller reset */
status = azx_readw(chip, STATESTS);
hda_tegra_init(hda); azx_init_chip(chip, 1);
participants (4)
-
Dylan Reid
-
Sachin Kamat
-
Stephen Warren
-
Takashi Iwai