Accepting request 357837 from multimedia:libs

1

OBS-URL: https://build.opensuse.org/request/show/357837
OBS-URL: https://build.opensuse.org/package/show/openSUSE:Factory/alsa?expand=0&rev=166
This commit is contained in:
Dominique Leuenberger 2016-02-09 15:48:35 +00:00 committed by Git OBS Bridge
commit 4825c45172
14 changed files with 842 additions and 1 deletions

View File

@ -0,0 +1,42 @@
From 57ae61ce274964c100f8df372f2d3b4c68ac17b8 Mon Sep 17 00:00:00 2001
From: Peter Rosin <peda@axentia.se>
Date: Wed, 11 Nov 2015 16:11:10 +0100
Subject: [PATCH] pcm: simple: Fix asserts
Do not error out on the boundaries.
Signed-off-by: Peter Rosin <peda@axentia.se>
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
---
src/pcm/pcm_simple.c | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)
diff --git a/src/pcm/pcm_simple.c b/src/pcm/pcm_simple.c
index f943ec09b396..ce110833922e 100644
--- a/src/pcm/pcm_simple.c
+++ b/src/pcm/pcm_simple.c
@@ -173,8 +173,8 @@ int snd_spcm_init(snd_pcm_t *pcm,
snd_pcm_sw_params_alloca(&sw_params);
assert(pcm);
- assert(rate > 5000 && rate < 192000);
- assert(channels > 1 && channels < 512);
+ assert(rate >= 5000 && rate <= 192000);
+ assert(channels >= 1 && channels <= 512);
rrate = rate;
err = set_buffer_time(latency, &buffer_time);
@@ -233,8 +233,8 @@ int snd_spcm_init_duplex(snd_pcm_t *playback_pcm,
assert(playback_pcm);
assert(capture_pcm);
- assert(rate > 5000 && rate < 192000);
- assert(channels > 1 && channels < 512);
+ assert(rate >= 5000 && rate <= 192000);
+ assert(channels >= 1 && channels <= 512);
pcms[0] = playback_pcm;
pcms[1] = capture_pcm;
--
2.7.0

View File

@ -0,0 +1,39 @@
From 9b09a3d500ff4d29f39d09ec2ba82b0ee561b217 Mon Sep 17 00:00:00 2001
From: Vinod Koul <vinod.koul@intel.com>
Date: Wed, 18 Nov 2015 19:12:46 +0530
Subject: [PATCH] topology: open topology files with O_TRUNC
The topology file if exists needs to rewritten, so we need to open these
files with O_TRUNC flag as well
Signed-off-by: Vinod Koul <vinod.koul@intel.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
---
src/topology/parser.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/src/topology/parser.c b/src/topology/parser.c
index 18bb9c79f3a8..e6798be9b79a 100644
--- a/src/topology/parser.c
+++ b/src/topology/parser.c
@@ -260,7 +260,7 @@ int snd_tplg_build_file(snd_tplg_t *tplg, const char *infile,
int err = 0;
tplg->out_fd =
- open(outfile, O_RDWR | O_CREAT, S_IRUSR | S_IWUSR);
+ open(outfile, O_RDWR | O_CREAT | O_TRUNC, S_IRUSR | S_IWUSR);
if (tplg->out_fd < 0) {
SNDERR("error: failed to open %s err %d\n",
outfile, -errno);
@@ -328,7 +328,7 @@ int snd_tplg_build(snd_tplg_t *tplg, const char *outfile)
int err;
tplg->out_fd =
- open(outfile, O_RDWR | O_CREAT, S_IRUSR | S_IWUSR);
+ open(outfile, O_RDWR | O_CREAT | O_TRUNC, S_IRUSR | S_IWUSR);
if (tplg->out_fd < 0) {
SNDERR("error: failed to open %s err %d\n",
outfile, -errno);
--
2.7.0

View File

@ -0,0 +1,52 @@
From a661f144d9a5a73ae1e1972a5b9b00ff5ed50ee2 Mon Sep 17 00:00:00 2001
From: Mengdong Lin <mengdong.lin@linux.intel.com>
Date: Wed, 18 Nov 2015 02:22:59 -0500
Subject: [PATCH] topology: Remove unused function write_data_block()
Fix gcc warning: 'write_data_block' defined but not used
[-Wunused-function].
Signed-off-by: Mengdong Lin <mengdong.lin@linux.intel.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
---
src/topology/builder.c | 24 ------------------------
1 file changed, 24 deletions(-)
diff --git a/src/topology/builder.c b/src/topology/builder.c
index 154bd6302fe6..b0ba54e4ad2c 100644
--- a/src/topology/builder.c
+++ b/src/topology/builder.c
@@ -82,30 +82,6 @@ static int write_block_header(snd_tplg_t *tplg, unsigned int type,
return bytes;
}
-static int write_data_block(snd_tplg_t *tplg, int size, int tplg_type,
- const char *obj_name, void *data)
-{
- int ret;
-
- /* write the header for this block */
- ret = write_block_header(tplg, tplg_type, 0,
- tplg->version, 0, size, 1);
- if (ret < 0) {
- SNDERR("error: failed to write %s block %d\n", obj_name, ret);
- return ret;
- }
-
- verbose(tplg, " %s : write %d bytes\n", obj_name, size);
-
- ret = write(tplg->out_fd, data, size);
- if (ret < 0) {
- SNDERR("error: failed to write %s %d\n", obj_name, ret);
- return ret;
- }
-
- return 0;
-}
-
static int write_elem_block(snd_tplg_t *tplg,
struct list_head *base, int size, int tplg_type, const char *obj_name)
{
--
2.7.0

View File

@ -0,0 +1,53 @@
From 605551aec6b4a1b5ca1d1fc519d0f4ce2488e786 Mon Sep 17 00:00:00 2001
From: Mengdong Lin <mengdong.lin@linux.intel.com>
Date: Wed, 18 Nov 2015 02:23:19 -0500
Subject: [PATCH] topology: Remove unused variables
Fix gcc warning when -Wunused-variable is set.
Signed-off-by: Mengdong Lin <mengdong.lin@linux.intel.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
---
src/topology/pcm.c | 5 +----
1 file changed, 1 insertion(+), 4 deletions(-)
diff --git a/src/topology/pcm.c b/src/topology/pcm.c
index 9b7e402e9424..8eb62e46bfc2 100644
--- a/src/topology/pcm.c
+++ b/src/topology/pcm.c
@@ -58,7 +58,6 @@ static int tplg_build_pcm_caps(snd_tplg_t *tplg, struct tplg_elem *elem)
struct tplg_elem *ref_elem = NULL;
struct snd_soc_tplg_pcm *pcm;
struct snd_soc_tplg_stream_caps *caps;
- struct snd_soc_tplg_stream *stream;
unsigned int i;
pcm = elem->pcm;
@@ -273,7 +272,7 @@ int tplg_parse_stream_caps(snd_tplg_t *tplg, snd_config_t *cfg,
struct tplg_elem *elem = private;
struct snd_soc_tplg_pcm *pcm;
const char *id, *value;
- int err, stream;
+ int stream;
pcm = elem->pcm;
@@ -384,7 +383,6 @@ int tplg_parse_be(snd_tplg_t *tplg,
snd_config_iterator_t i, next;
snd_config_t *n;
const char *id, *val = NULL;
- int err;
elem = tplg_elem_new_common(tplg, cfg, NULL, SND_TPLG_TYPE_BE);
if (!elem)
@@ -438,7 +436,6 @@ int tplg_parse_cc(snd_tplg_t *tplg,
snd_config_iterator_t i, next;
snd_config_t *n;
const char *id, *val = NULL;
- int err;
elem = tplg_elem_new_common(tplg, cfg, NULL, SND_TPLG_TYPE_CC);
if (!elem)
--
2.7.0

View File

@ -0,0 +1,48 @@
From 8504a41d9424456f2cdca058d036eb42c195ee52 Mon Sep 17 00:00:00 2001
From: Mengdong Lin <mengdong.lin@linux.intel.com>
Date: Wed, 18 Nov 2015 02:23:59 -0500
Subject: [PATCH] topology: Fix comparison of unsigned expression < 0
Fix gcc warning: comparison of unsigned expression < 0 is always false
[-Wtype-limits]
The ABI object channel->id is _le32 and is converted to host unsigned
integer. It cannot be < 0.
Signed-off-by: Mengdong Lin <mengdong.lin@linux.intel.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
---
src/topology/channel.c | 6 ++++--
1 file changed, 4 insertions(+), 2 deletions(-)
diff --git a/src/topology/channel.c b/src/topology/channel.c
index 9bc5d5a77c57..c2f1feadca9a 100644
--- a/src/topology/channel.c
+++ b/src/topology/channel.c
@@ -80,6 +80,7 @@ int tplg_parse_channel(snd_tplg_t *tplg,
snd_config_t *n;
struct snd_soc_tplg_channel *channel = private;
const char *id, *value;
+ int channel_id;
if (tplg->channel_idx >= SND_SOC_TPLG_MAX_CHAN)
return -EINVAL;
@@ -88,12 +89,13 @@ int tplg_parse_channel(snd_tplg_t *tplg,
snd_config_get_id(cfg, &id);
tplg_dbg("\tChannel %s at index %d\n", id, tplg->channel_idx);
- channel->id = lookup_channel(id);
- if (channel->id < 0) {
+ channel_id = lookup_channel(id);
+ if (channel_id < 0) {
SNDERR("error: invalid channel %s\n", id);
return -EINVAL;
}
+ channel->id = channel_id;
channel->size = sizeof(*channel);
tplg_dbg("\tChan %s = %d\n", id, channel->id);
--
2.7.0

View File

@ -0,0 +1,108 @@
From cde9a37c06a09e890d2c4b175bd548ed6f247f93 Mon Sep 17 00:00:00 2001
From: Mengdong Lin <mengdong.lin@linux.intel.com>
Date: Thu, 19 Nov 2015 03:33:05 -0500
Subject: [PATCH] topology: Not compare a for loop iterator with ABI __le32
variables
The iterator 'i' in a loop is a usually a integer. But ABI variables use
type _le32, which is converted to host unsigned integer. Comparing them
can cause gcc warning: comparison between signed and unsigned integer
expressions[-Wsign-compare].
Signed-off-by: Mengdong Lin <mengdong.lin@linux.intel.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
---
src/topology/ctl.c | 22 +++++++++++-----------
src/topology/pcm.c | 4 ++--
2 files changed, 13 insertions(+), 13 deletions(-)
diff --git a/src/topology/ctl.c b/src/topology/ctl.c
index 7d8787f347b8..1c073f7cc32a 100644
--- a/src/topology/ctl.c
+++ b/src/topology/ctl.c
@@ -676,7 +676,7 @@ int tplg_add_mixer(snd_tplg_t *tplg, struct snd_tplg_mixer_template *mixer,
struct snd_soc_tplg_private *priv = mixer->priv;
struct snd_soc_tplg_mixer_control *mc;
struct tplg_elem *elem;
- int ret, i;
+ int ret, i, num_channels;
tplg_dbg(" Control Mixer: %s\n", mixer->hdr.name);
@@ -708,9 +708,10 @@ int tplg_add_mixer(snd_tplg_t *tplg, struct snd_tplg_mixer_template *mixer,
for (i = 0; i < SND_SOC_TPLG_MAX_CHAN; i++)
mc->channel[i].reg = -1;
- if (mixer->map)
- mc->num_channels = mixer->map->num_channels;
- for (i = 0; i < mc->num_channels; i++) {
+ num_channels = mixer->map ? mixer->map->num_channels : 0;
+ mc->num_channels = num_channels;
+
+ for (i = 0; i < num_channels; i++) {
struct snd_tplg_channel_elem *channel = &mixer->map->channel[i];
mc->channel[i].size = channel->size;
@@ -743,7 +744,7 @@ int tplg_add_enum(snd_tplg_t *tplg, struct snd_tplg_enum_template *enum_ctl,
{
struct snd_soc_tplg_enum_control *ec;
struct tplg_elem *elem;
- int ret, i;
+ int ret, i, num_items;
tplg_dbg(" Control Enum: %s\n", enum_ctl->hdr.name);
@@ -765,15 +766,14 @@ int tplg_add_enum(snd_tplg_t *tplg, struct snd_tplg_enum_template *enum_ctl,
return ret;
}
- ec->items = enum_ctl->items;
- if (ec->items > SND_SOC_TPLG_NUM_TEXTS)
- ec->items = SND_SOC_TPLG_NUM_TEXTS;
-
+ num_items = enum_ctl->items < SND_SOC_TPLG_NUM_TEXTS ?
+ enum_ctl->items : SND_SOC_TPLG_NUM_TEXTS;
+ ec->items = num_items;
ec->mask = enum_ctl->mask;
ec->count = enum_ctl->items;
if (enum_ctl->texts != NULL) {
- for (i = 0; i < ec->items; i++) {
+ for (i = 0; i < num_items; i++) {
if (enum_ctl->texts[i] != NULL)
strncpy(ec->texts[i], enum_ctl->texts[i],
SNDRV_CTL_ELEM_ID_NAME_MAXLEN);
@@ -781,7 +781,7 @@ int tplg_add_enum(snd_tplg_t *tplg, struct snd_tplg_enum_template *enum_ctl,
}
if (enum_ctl->values != NULL) {
- for (i = 0; i < ec->items; i++) {
+ for (i = 0; i < num_items; i++) {
if (enum_ctl->values[i])
continue;
diff --git a/src/topology/pcm.c b/src/topology/pcm.c
index 8eb62e46bfc2..d75aad88672a 100644
--- a/src/topology/pcm.c
+++ b/src/topology/pcm.c
@@ -550,7 +550,7 @@ int tplg_add_pcm_object(snd_tplg_t *tplg, snd_tplg_obj_template_t *t)
}
pcm->num_streams = pcm_tpl->num_streams;
- for (i = 0; i < pcm->num_streams; i++)
+ for (i = 0; i < pcm_tpl->num_streams; i++)
tplg_add_stream_object(&pcm->stream[i], &pcm_tpl->stream[i]);
return 0;
@@ -583,7 +583,7 @@ int tplg_add_link_object(snd_tplg_t *tplg, snd_tplg_obj_template_t *t)
lk->id = link->id;
lk->num_streams = link->num_streams;
- for (i = 0; i < lk->num_streams; i++)
+ for (i = 0; i < link->num_streams; i++)
tplg_add_stream_object(&lk->stream[i], &link->stream[i]);
return 0;
--
2.7.0

View File

@ -0,0 +1,62 @@
From b917a0c0a87a07e2397a3468adf44f33fa329dde Mon Sep 17 00:00:00 2001
From: Mengdong Lin <mengdong.lin@linux.intel.com>
Date: Thu, 19 Nov 2015 03:33:12 -0500
Subject: [PATCH] topology: Quit and show error message on big-endian machines
This tool can only support little-endian machines atm.
Many codes directly refer to __le32/__le64 variables of ABI objects,
so will be broken on big-endian machines.
Signed-off-by: Mengdong Lin <mengdong.lin@linux.intel.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
---
src/topology/parser.c | 15 +++++++++++++++
src/topology/tplg_local.h | 2 ++
2 files changed, 17 insertions(+)
diff --git a/src/topology/parser.c b/src/topology/parser.c
index e6798be9b79a..45462577e71c 100644
--- a/src/topology/parser.c
+++ b/src/topology/parser.c
@@ -371,10 +371,25 @@ void snd_tplg_verbose(snd_tplg_t *tplg, int verbose)
tplg->verbose = verbose;
}
+static bool is_little_endian(void)
+{
+#ifdef __BYTE_ORDER
+ #if __BYTE_ORDER == __LITTLE_ENDIAN
+ return true;
+ #endif
+#endif
+ return false;
+}
+
snd_tplg_t *snd_tplg_new(void)
{
snd_tplg_t *tplg;
+ if (!is_little_endian()) {
+ SNDERR("error: cannot support big-endian machines\n");
+ return NULL;
+ }
+
tplg = calloc(1, sizeof(snd_tplg_t));
if (!tplg)
return NULL;
diff --git a/src/topology/tplg_local.h b/src/topology/tplg_local.h
index 06cb1005760c..e66d7f4e2d73 100644
--- a/src/topology/tplg_local.h
+++ b/src/topology/tplg_local.h
@@ -12,6 +12,8 @@
#include <limits.h>
#include <stdint.h>
+#include <stdbool.h>
+#include <endian.h>
#include <linux/types.h>
#include "local.h"
--
2.7.0

View File

@ -0,0 +1,30 @@
From c7e87084412b26ea36cc62ac557bcde18f56bf22 Mon Sep 17 00:00:00 2001
From: Jaroslav Kysela <perex@perex.cz>
Date: Tue, 12 Jan 2016 14:56:18 +0100
Subject: [PATCH] config files - do not include ucm/topology configuration when
not requested
---
src/conf/Makefile.am | 9 ++++++++-
1 file changed, 8 insertions(+), 1 deletion(-)
diff --git a/src/conf/Makefile.am b/src/conf/Makefile.am
index a04f73fddc65..5a3f857eff42 100644
--- a/src/conf/Makefile.am
+++ b/src/conf/Makefile.am
@@ -1,4 +1,11 @@
-SUBDIRS=cards pcm alsa.conf.d ucm topology
+SUBDIRS=cards pcm alsa.conf.d
+
+if BUILD_UCM
+SUBDIRS += ucm
+endif
+if BUILD_TOPOLOGY
+SUBDIRS += topology
+endif
cfg_files = alsa.conf
if BUILD_ALISP
--
2.7.0

View File

@ -0,0 +1,110 @@
From 822e781a47267b6efe70260486927f895b83ed84 Mon Sep 17 00:00:00 2001
From: Jaroslav Kysela <perex@perex.cz>
Date: Tue, 12 Jan 2016 15:58:25 +0100
Subject: [PATCH] control: add missing asserts to ctl_elem_set functions
---
src/control/control.c | 17 +++++++++++------
1 file changed, 11 insertions(+), 6 deletions(-)
diff --git a/src/control/control.c b/src/control/control.c
index 4a28cf6ea7c6..8504d07668cd 100644
--- a/src/control/control.c
+++ b/src/control/control.c
@@ -2497,7 +2497,7 @@ void snd_ctl_elem_value_set_index(snd_ctl_elem_value_t *obj, unsigned int val)
int snd_ctl_elem_value_get_boolean(const snd_ctl_elem_value_t *obj, unsigned int idx)
{
assert(obj);
- assert(idx < sizeof(obj->value.integer.value) / sizeof(obj->value.integer.value[0]));
+ assert(idx < ARRAY_SIZE(obj->value.integer.value));
return obj->value.integer.value[idx];
}
@@ -2510,7 +2510,7 @@ int snd_ctl_elem_value_get_boolean(const snd_ctl_elem_value_t *obj, unsigned int
long snd_ctl_elem_value_get_integer(const snd_ctl_elem_value_t *obj, unsigned int idx)
{
assert(obj);
- assert(idx < sizeof(obj->value.integer.value) / sizeof(obj->value.integer.value[0]));
+ assert(idx < ARRAY_SIZE(obj->value.integer.value));
return obj->value.integer.value[idx];
}
@@ -2523,7 +2523,7 @@ long snd_ctl_elem_value_get_integer(const snd_ctl_elem_value_t *obj, unsigned in
long long snd_ctl_elem_value_get_integer64(const snd_ctl_elem_value_t *obj, unsigned int idx)
{
assert(obj);
- assert(idx < sizeof(obj->value.integer64.value) / sizeof(obj->value.integer64.value[0]));
+ assert(idx < ARRAY_SIZE(obj->value.integer64.value));
return obj->value.integer64.value[idx];
}
@@ -2536,7 +2536,7 @@ long long snd_ctl_elem_value_get_integer64(const snd_ctl_elem_value_t *obj, unsi
unsigned int snd_ctl_elem_value_get_enumerated(const snd_ctl_elem_value_t *obj, unsigned int idx)
{
assert(obj);
- assert(idx < sizeof(obj->value.enumerated.item) / sizeof(obj->value.enumerated.item[0]));
+ assert(idx < ARRAY_SIZE(obj->value.enumerated.item));
return obj->value.enumerated.item[idx];
}
@@ -2549,7 +2549,7 @@ unsigned int snd_ctl_elem_value_get_enumerated(const snd_ctl_elem_value_t *obj,
unsigned char snd_ctl_elem_value_get_byte(const snd_ctl_elem_value_t *obj, unsigned int idx)
{
assert(obj);
- assert(idx < sizeof(obj->value.bytes.data));
+ assert(idx < ARRAY_SIZE(obj->value.bytes.data));
return obj->value.bytes.data[idx];
}
@@ -2562,6 +2562,7 @@ unsigned char snd_ctl_elem_value_get_byte(const snd_ctl_elem_value_t *obj, unsig
void snd_ctl_elem_value_set_boolean(snd_ctl_elem_value_t *obj, unsigned int idx, long val)
{
assert(obj);
+ assert(idx < ARRAY_SIZE(obj->value.integer.value));
obj->value.integer.value[idx] = val;
}
@@ -2574,6 +2575,7 @@ void snd_ctl_elem_value_set_boolean(snd_ctl_elem_value_t *obj, unsigned int idx,
void snd_ctl_elem_value_set_integer(snd_ctl_elem_value_t *obj, unsigned int idx, long val)
{
assert(obj);
+ assert(idx < ARRAY_SIZE(obj->value.integer.value));
obj->value.integer.value[idx] = val;
}
@@ -2586,6 +2588,7 @@ void snd_ctl_elem_value_set_integer(snd_ctl_elem_value_t *obj, unsigned int idx,
void snd_ctl_elem_value_set_integer64(snd_ctl_elem_value_t *obj, unsigned int idx, long long val)
{
assert(obj);
+ assert(idx < ARRAY_SIZE(obj->value.integer64.value));
obj->value.integer64.value[idx] = val;
}
@@ -2598,6 +2601,7 @@ void snd_ctl_elem_value_set_integer64(snd_ctl_elem_value_t *obj, unsigned int id
void snd_ctl_elem_value_set_enumerated(snd_ctl_elem_value_t *obj, unsigned int idx, unsigned int val)
{
assert(obj);
+ assert(idx < ARRAY_SIZE(obj->value.enumerated.item));
obj->value.enumerated.item[idx] = val;
}
@@ -2610,6 +2614,7 @@ void snd_ctl_elem_value_set_enumerated(snd_ctl_elem_value_t *obj, unsigned int i
void snd_ctl_elem_value_set_byte(snd_ctl_elem_value_t *obj, unsigned int idx, unsigned char val)
{
assert(obj);
+ assert(idx < ARRAY_SIZE(obj->value.bytes.data));
obj->value.bytes.data[idx] = val;
}
@@ -2622,7 +2627,7 @@ void snd_ctl_elem_value_set_byte(snd_ctl_elem_value_t *obj, unsigned int idx, un
void snd_ctl_elem_set_bytes(snd_ctl_elem_value_t *obj, void *data, size_t size)
{
assert(obj);
- if (size >= sizeof(obj->value.bytes.data)) {
+ if (size >= ARRAY_SIZE(obj->value.bytes.data)) {
assert(0);
return;
}
--
2.7.0

View File

@ -0,0 +1,137 @@
From 0f4f48d37716be0e6ddccb2124c5e09d5bd1cab3 Mon Sep 17 00:00:00 2001
From: Jaroslav Kysela <perex@perex.cz>
Date: Tue, 12 Jan 2016 16:07:16 +0100
Subject: [PATCH] pcm_hw: fix possible memory leak (coverity)
---
src/pcm/pcm.c | 2 +-
src/pcm/pcm_hw.c | 36 ++++++++++++++++++++----------------
2 files changed, 21 insertions(+), 17 deletions(-)
diff --git a/src/pcm/pcm.c b/src/pcm/pcm.c
index cbbc55ae6ec9..203e7a52491b 100644
--- a/src/pcm/pcm.c
+++ b/src/pcm/pcm.c
@@ -7512,7 +7512,7 @@ snd_pcm_chmap_query_t **snd_pcm_query_chmaps(snd_pcm_t *pcm)
*/
void snd_pcm_free_chmaps(snd_pcm_chmap_query_t **maps)
{
- snd_pcm_chmap_query_t **p = maps;
+ snd_pcm_chmap_query_t **p;
if (!maps)
return;
for (p = maps; *p; p++)
diff --git a/src/pcm/pcm_hw.c b/src/pcm/pcm_hw.c
index 66aec5c615ed..4f4b84b2d2bc 100644
--- a/src/pcm/pcm_hw.c
+++ b/src/pcm/pcm_hw.c
@@ -1693,12 +1693,14 @@ int _snd_pcm_hw_open(snd_pcm_t **pcmp, const char *name,
err = snd_config_get_string(n, &str);
if (err < 0) {
SNDERR("Invalid type for %s", id);
- return -EINVAL;
+ err = -EINVAL;
+ goto fail;
}
card = snd_card_get_index(str);
if (card < 0) {
SNDERR("Invalid value for %s", id);
- return card;
+ err = card;
+ goto fail;
}
}
continue;
@@ -1707,7 +1709,7 @@ int _snd_pcm_hw_open(snd_pcm_t **pcmp, const char *name,
err = snd_config_get_integer(n, &device);
if (err < 0) {
SNDERR("Invalid type for %s", id);
- return err;
+ goto fail;
}
continue;
}
@@ -1715,7 +1717,7 @@ int _snd_pcm_hw_open(snd_pcm_t **pcmp, const char *name,
err = snd_config_get_integer(n, &subdevice);
if (err < 0) {
SNDERR("Invalid type for %s", id);
- return err;
+ goto fail;
}
continue;
}
@@ -1738,7 +1740,7 @@ int _snd_pcm_hw_open(snd_pcm_t **pcmp, const char *name,
err = snd_config_get_integer(n, &val);
if (err < 0) {
SNDERR("Invalid type for %s", id);
- return err;
+ goto fail;
}
rate = val;
continue;
@@ -1747,7 +1749,7 @@ int _snd_pcm_hw_open(snd_pcm_t **pcmp, const char *name,
err = snd_config_get_string(n, &str);
if (err < 0) {
SNDERR("invalid type for %s", id);
- return err;
+ goto fail;
}
format = snd_pcm_format_value(str);
continue;
@@ -1757,7 +1759,7 @@ int _snd_pcm_hw_open(snd_pcm_t **pcmp, const char *name,
err = snd_config_get_integer(n, &val);
if (err < 0) {
SNDERR("Invalid type for %s", id);
- return err;
+ goto fail;
}
channels = val;
continue;
@@ -1767,26 +1769,24 @@ int _snd_pcm_hw_open(snd_pcm_t **pcmp, const char *name,
chmap = _snd_pcm_parse_config_chmaps(n);
if (!chmap) {
SNDERR("Invalid channel map for %s", id);
- return -EINVAL;
+ goto fail;
}
continue;
}
SNDERR("Unknown field %s", id);
- snd_pcm_free_chmaps(chmap);
- return -EINVAL;
+ err = -EINVAL;
+ goto fail;
}
if (card < 0) {
SNDERR("card is not defined");
- snd_pcm_free_chmaps(chmap);
- return -EINVAL;
+ err = -EINVAL;
+ goto fail;
}
err = snd_pcm_hw_open(pcmp, name, card, device, subdevice, stream,
mode | (nonblock ? SND_PCM_NONBLOCK : 0),
0, sync_ptr_ioctl);
- if (err < 0) {
- snd_pcm_free_chmaps(chmap);
- return err;
- }
+ if (err < 0)
+ goto fail;
if (nonblock && ! (mode & SND_PCM_NONBLOCK)) {
/* revert to blocking mode for read/write access */
snd_pcm_hw_nonblock(*pcmp, 0);
@@ -1810,6 +1810,10 @@ int _snd_pcm_hw_open(snd_pcm_t **pcmp, const char *name,
hw->chmap_override = chmap;
return 0;
+
+fail:
+ snd_pcm_free_chmaps(chmap);
+ return err;
}
#ifndef DOC_HIDDEN
--
2.7.0

89
0012-coverity-fixes.patch Normal file
View File

@ -0,0 +1,89 @@
From df20aa2a1ea9cbcb3eb96c5684c1a00de29e2730 Mon Sep 17 00:00:00 2001
From: Jaroslav Kysela <perex@perex.cz>
Date: Tue, 12 Jan 2016 16:25:42 +0100
Subject: [PATCH] coverity fixes
---
aserver/aserver.c | 1 +
src/control/control.c | 2 +-
src/control/ctlparse.c | 4 ++--
src/control/namehint.c | 2 ++
src/pcm/pcm_multi.c | 2 ++
5 files changed, 8 insertions(+), 3 deletions(-)
diff --git a/aserver/aserver.c b/aserver/aserver.c
index 1579da7b44eb..ac20706b9e0b 100644
--- a/aserver/aserver.c
+++ b/aserver/aserver.c
@@ -93,6 +93,7 @@ static int make_inet_socket(int port)
return result;
}
+ memset(&addr, 0, sizeof(addr));
addr.sin_family = AF_INET;
addr.sin_port = htons(port);
addr.sin_addr.s_addr = INADDR_ANY;
diff --git a/src/control/control.c b/src/control/control.c
index 8504d07668cd..328920d989c3 100644
--- a/src/control/control.c
+++ b/src/control/control.c
@@ -411,7 +411,7 @@ int snd_ctl_elem_add_enumerated(snd_ctl_t *ctl, const snd_ctl_elem_id_t *id,
bytes = 0;
for (i = 0; i < items; ++i)
bytes += strlen(names[i]) + 1;
- buf = malloc(bytes);
+ buf = bytes ? malloc(bytes) : NULL;
if (!buf)
return -ENOMEM;
info->value.enumerated.names_ptr = (uintptr_t)buf;
diff --git a/src/control/ctlparse.c b/src/control/ctlparse.c
index 877a05e3a1f1..d38b44ef986c 100644
--- a/src/control/ctlparse.c
+++ b/src/control/ctlparse.c
@@ -62,7 +62,7 @@ static long get_integer(const char **ptr, long min, long max)
val = strtol(s, &p, 0);
if (*p == '.') {
p++;
- strtol(p, &p, 10);
+ (void)strtol(p, &p, 10);
}
if (*p == '%') {
val = (long)convert_prange1(strtod(s, NULL), min, max);
@@ -90,7 +90,7 @@ static long long get_integer64(const char **ptr, long long min, long long max)
val = strtol(s, &p, 0);
if (*p == '.') {
p++;
- strtol(p, &p, 10);
+ (void)strtol(p, &p, 10);
}
if (*p == '%') {
val = (long long)convert_prange1(strtod(s, NULL), min, max);
diff --git a/src/control/namehint.c b/src/control/namehint.c
index b3e646eb10af..856957c76d74 100644
--- a/src/control/namehint.c
+++ b/src/control/namehint.c
@@ -559,6 +559,8 @@ int snd_device_name_hint(int card, const char *iface, void ***hints)
if (err < 0)
return err;
err = snd_config_copy(&local_config_rw, local_config);
+ if (err < 0)
+ return err;
list.list = NULL;
list.count = list.allocated = 0;
list.siface = iface;
diff --git a/src/pcm/pcm_multi.c b/src/pcm/pcm_multi.c
index 4b8299ed6bcd..c4b1fba32cac 100644
--- a/src/pcm/pcm_multi.c
+++ b/src/pcm/pcm_multi.c
@@ -888,6 +888,8 @@ static int snd_pcm_multi_set_chmap(snd_pcm_t *pcm, const snd_pcm_chmap_t *map)
slave_maps[i] = calloc(multi->slaves[i].channels_count + 1,
sizeof(int));
if (!slave_maps[i]) {
+ for (i++; i < multi->slaves_count; i++)
+ slave_maps[i] = NULL;
err = -ENOMEM;
goto error;
}
--
2.7.0

View File

@ -0,0 +1,29 @@
From c3c9206d12c553c0f0fac45a1aac16c7edc152b2 Mon Sep 17 00:00:00 2001
From: Liam Girdwood <liam.r.girdwood@linux.intel.com>
Date: Mon, 1 Feb 2016 14:20:44 +0000
Subject: [PATCH] topology: fix debug output to print correct "max" value.
Debug log is printing num_regs instead of max in the max section.
Signed-off-by: Liam Girdwood <liam.r.girdwood@linux.intel.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
---
src/topology/ctl.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/src/topology/ctl.c b/src/topology/ctl.c
index 1c073f7cc32a..c25022728e51 100644
--- a/src/topology/ctl.c
+++ b/src/topology/ctl.c
@@ -350,7 +350,7 @@ int tplg_parse_control_bytes(snd_tplg_t *tplg,
return -EINVAL;
be->max = atoi(val);
- tplg_dbg("\t%s: %d\n", id, be->num_regs);
+ tplg_dbg("\t%s: %d\n", id, be->max);
continue;
}
--
2.7.0

View File

@ -1,3 +1,21 @@
-------------------------------------------------------------------
Wed Feb 3 17:56:41 CET 2016 - tiwai@suse.de
- Backports from upstream: minor PCM fixes, topology API updates,
and a few build cleanup:
0002-pcm-simple-Fix-asserts.patch
0003-topology-open-topology-files-with-O_TRUNC.patch
0004-topology-Remove-unused-function-write_data_block.patch
0005-topology-Remove-unused-variables.patch
0006-topology-Fix-comparison-of-unsigned-expression-0.patch
0007-topology-Not-compare-a-for-loop-iterator-with-ABI-__.patch
0008-topology-Quit-and-show-error-message-on-big-endian-m.patch
0009-config-files-do-not-include-ucm-topology-configurati.patch
0010-control-add-missing-asserts-to-ctl_elem_set-function.patch
0011-pcm_hw-fix-possible-memory-leak-coverity.patch
0012-coverity-fixes.patch
0013-topology-fix-debug-output-to-print-correct-max-value.patch
-------------------------------------------------------------------
Mon Nov 9 11:32:40 CET 2015 - tiwai@suse.de

View File

@ -1,7 +1,7 @@
#
# spec file for package alsa
#
# Copyright (c) 2015 SUSE LINUX GmbH, Nuernberg, Germany.
# Copyright (c) 2016 SUSE LINUX GmbH, Nuernberg, Germany.
#
# All modifications and additions to the file contributed by third parties
# remain the property of their copyright owners, unless otherwise agreed
@ -50,6 +50,18 @@ Source41: install-snd-module
# Patch: alsa-lib-git-fixes.diff
# upstream fixes
Patch1: 0001-topology-Add-missing-include-sys-stat.h.patch
Patch2: 0002-pcm-simple-Fix-asserts.patch
Patch3: 0003-topology-open-topology-files-with-O_TRUNC.patch
Patch4: 0004-topology-Remove-unused-function-write_data_block.patch
Patch5: 0005-topology-Remove-unused-variables.patch
Patch6: 0006-topology-Fix-comparison-of-unsigned-expression-0.patch
Patch7: 0007-topology-Not-compare-a-for-loop-iterator-with-ABI-__.patch
Patch8: 0008-topology-Quit-and-show-error-message-on-big-endian-m.patch
Patch9: 0009-config-files-do-not-include-ucm-topology-configurati.patch
Patch10: 0010-control-add-missing-asserts-to-ctl_elem_set-function.patch
Patch11: 0011-pcm_hw-fix-possible-memory-leak-coverity.patch
Patch12: 0012-coverity-fixes.patch
Patch13: 0013-topology-fix-debug-output-to-print-correct-max-value.patch
# rest suse patches
Patch99: alsa-lib-doxygen-avoid-crash-for-11.3.diff
# suppress timestamp in documents
@ -121,6 +133,18 @@ Architecture.
%setup -q -n alsa-lib-%{package_version}
# %patch -p1
%patch1 -p1
%patch2 -p1
%patch3 -p1
%patch4 -p1
%patch5 -p1
%patch6 -p1
%patch7 -p1
%patch8 -p1
%patch9 -p1
%patch10 -p1
%patch11 -p1
%patch12 -p1
%patch13 -p1
%if 0%{?suse_version} == 1130
%patch99 -p1
%endif