Commit ff6c95d2 authored by Mark Brown's avatar Mark Brown

Merge series "ASoC: soc-core: cleanup cppcheck warning" from Kuninori Morimoto...

Merge series "ASoC: soc-core: cleanup cppcheck warning" from Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>:

Hi Mark

Now I'm posting audio-graph-card2 patch-set, but it seems it needs longer
discussion. Thus I want to post more easy patch first, and reduce my
local patches.

These are cppcheck warning cleanup patches for soc-core.

Kuninori Morimoto (7):
  ASoC: soc-core: cleanup cppcheck warning at snd_soc_set_dmi_name()
  ASoC: soc-core: cleanup cppcheck warning at snd_soc_get_dai_name()
  ASoC: soc-core: cleanup cppcheck warning at snd_soc_daifmt_parse_format()
  ASoC: soc-core: cleanup cppcheck warning at snd_soc_unregister_component()
  ASoC: soc-core: cleanup cppcheck warning at snd_soc_add_controls()
  ASoC: soc-core: cleanup cppcheck warning at snd_soc_of_parse_audio_simple_widgets()
  ASoC: soc-core: cleanup cppcheck warning at snd_soc_of_parse_audio_routing()

 sound/soc/soc-core.c | 36 ++++++++++++++++++------------------
 1 file changed, 18 insertions(+), 18 deletions(-)

--
2.25.1
parents dfe11146 51a3dd58
...@@ -1718,7 +1718,7 @@ static void append_dmi_string(struct snd_soc_card *card, const char *str) ...@@ -1718,7 +1718,7 @@ static void append_dmi_string(struct snd_soc_card *card, const char *str)
*/ */
int snd_soc_set_dmi_name(struct snd_soc_card *card, const char *flavour) int snd_soc_set_dmi_name(struct snd_soc_card *card, const char *flavour)
{ {
const char *vendor, *product, *product_version, *board; const char *vendor, *product, *board;
if (card->long_name) if (card->long_name)
return 0; /* long name already set by driver or from DMI */ return 0; /* long name already set by driver or from DMI */
...@@ -1738,13 +1738,14 @@ int snd_soc_set_dmi_name(struct snd_soc_card *card, const char *flavour) ...@@ -1738,13 +1738,14 @@ int snd_soc_set_dmi_name(struct snd_soc_card *card, const char *flavour)
product = dmi_get_system_info(DMI_PRODUCT_NAME); product = dmi_get_system_info(DMI_PRODUCT_NAME);
if (product && is_dmi_valid(product)) { if (product && is_dmi_valid(product)) {
const char *product_version = dmi_get_system_info(DMI_PRODUCT_VERSION);
append_dmi_string(card, product); append_dmi_string(card, product);
/* /*
* some vendors like Lenovo may only put a self-explanatory * some vendors like Lenovo may only put a self-explanatory
* name in the product version field * name in the product version field
*/ */
product_version = dmi_get_system_info(DMI_PRODUCT_VERSION);
if (product_version && is_dmi_valid(product_version)) if (product_version && is_dmi_valid(product_version))
append_dmi_string(card, product_version); append_dmi_string(card, product_version);
} }
...@@ -2236,13 +2237,12 @@ static int snd_soc_add_controls(struct snd_card *card, struct device *dev, ...@@ -2236,13 +2237,12 @@ static int snd_soc_add_controls(struct snd_card *card, struct device *dev,
const struct snd_kcontrol_new *controls, int num_controls, const struct snd_kcontrol_new *controls, int num_controls,
const char *prefix, void *data) const char *prefix, void *data)
{ {
int err, i; int i;
for (i = 0; i < num_controls; i++) { for (i = 0; i < num_controls; i++) {
const struct snd_kcontrol_new *control = &controls[i]; const struct snd_kcontrol_new *control = &controls[i];
int err = snd_ctl_add(card, snd_soc_cnew(control, data,
err = snd_ctl_add(card, snd_soc_cnew(control, data, control->name, prefix));
control->name, prefix));
if (err < 0) { if (err < 0) {
dev_err(dev, "ASoC: Failed to add %s: %d\n", dev_err(dev, "ASoC: Failed to add %s: %d\n",
control->name, err); control->name, err);
...@@ -2716,11 +2716,10 @@ EXPORT_SYMBOL_GPL(snd_soc_unregister_component_by_driver); ...@@ -2716,11 +2716,10 @@ EXPORT_SYMBOL_GPL(snd_soc_unregister_component_by_driver);
*/ */
void snd_soc_unregister_component(struct device *dev) void snd_soc_unregister_component(struct device *dev)
{ {
struct snd_soc_component *component;
mutex_lock(&client_mutex); mutex_lock(&client_mutex);
while (1) { while (1) {
component = snd_soc_lookup_component_nolocked(dev, NULL); struct snd_soc_component *component = snd_soc_lookup_component_nolocked(dev, NULL);
if (!component) if (!component)
break; break;
...@@ -2774,7 +2773,7 @@ int snd_soc_of_parse_audio_simple_widgets(struct snd_soc_card *card, ...@@ -2774,7 +2773,7 @@ int snd_soc_of_parse_audio_simple_widgets(struct snd_soc_card *card,
struct device_node *np = card->dev->of_node; struct device_node *np = card->dev->of_node;
struct snd_soc_dapm_widget *widgets; struct snd_soc_dapm_widget *widgets;
const char *template, *wname; const char *template, *wname;
int i, j, num_widgets, ret; int i, j, num_widgets;
num_widgets = of_property_count_strings(np, propname); num_widgets = of_property_count_strings(np, propname);
if (num_widgets < 0) { if (num_widgets < 0) {
...@@ -2804,8 +2803,8 @@ int snd_soc_of_parse_audio_simple_widgets(struct snd_soc_card *card, ...@@ -2804,8 +2803,8 @@ int snd_soc_of_parse_audio_simple_widgets(struct snd_soc_card *card,
} }
for (i = 0; i < num_widgets; i++) { for (i = 0; i < num_widgets; i++) {
ret = of_property_read_string_index(np, propname, int ret = of_property_read_string_index(np, propname,
2 * i, &template); 2 * i, &template);
if (ret) { if (ret) {
dev_err(card->dev, dev_err(card->dev,
"ASoC: Property '%s' index %d read error:%d\n", "ASoC: Property '%s' index %d read error:%d\n",
...@@ -2928,7 +2927,7 @@ int snd_soc_of_parse_audio_routing(struct snd_soc_card *card, ...@@ -2928,7 +2927,7 @@ int snd_soc_of_parse_audio_routing(struct snd_soc_card *card,
struct device_node *np = card->dev->of_node; struct device_node *np = card->dev->of_node;
int num_routes; int num_routes;
struct snd_soc_dapm_route *routes; struct snd_soc_dapm_route *routes;
int i, ret; int i;
num_routes = of_property_count_strings(np, propname); num_routes = of_property_count_strings(np, propname);
if (num_routes < 0 || num_routes & 1) { if (num_routes < 0 || num_routes & 1) {
...@@ -2948,8 +2947,8 @@ int snd_soc_of_parse_audio_routing(struct snd_soc_card *card, ...@@ -2948,8 +2947,8 @@ int snd_soc_of_parse_audio_routing(struct snd_soc_card *card,
} }
for (i = 0; i < num_routes; i++) { for (i = 0; i < num_routes; i++) {
ret = of_property_read_string_index(np, propname, int ret = of_property_read_string_index(np, propname,
2 * i, &routes[i].sink); 2 * i, &routes[i].sink);
if (ret) { if (ret) {
dev_err(card->dev, dev_err(card->dev,
"ASoC: Property '%s' index %d could not be read: %d\n", "ASoC: Property '%s' index %d could not be read: %d\n",
...@@ -3053,7 +3052,7 @@ EXPORT_SYMBOL_GPL(snd_soc_daifmt_clock_provider_from_bitmap); ...@@ -3053,7 +3052,7 @@ EXPORT_SYMBOL_GPL(snd_soc_daifmt_clock_provider_from_bitmap);
unsigned int snd_soc_daifmt_parse_format(struct device_node *np, unsigned int snd_soc_daifmt_parse_format(struct device_node *np,
const char *prefix) const char *prefix)
{ {
int ret, i; int ret;
char prop[128]; char prop[128];
unsigned int format = 0; unsigned int format = 0;
int bit, frame; int bit, frame;
...@@ -3087,6 +3086,8 @@ unsigned int snd_soc_daifmt_parse_format(struct device_node *np, ...@@ -3087,6 +3086,8 @@ unsigned int snd_soc_daifmt_parse_format(struct device_node *np,
ret = of_property_read_string(np, prop, &str); ret = of_property_read_string(np, prop, &str);
} }
if (ret == 0) { if (ret == 0) {
int i;
for (i = 0; i < ARRAY_SIZE(of_fmt_table); i++) { for (i = 0; i < ARRAY_SIZE(of_fmt_table); i++) {
if (strcmp(str, of_fmt_table[i].name) == 0) { if (strcmp(str, of_fmt_table[i].name) == 0) {
format |= of_fmt_table[i].val; format |= of_fmt_table[i].val;
...@@ -3200,12 +3201,11 @@ int snd_soc_get_dai_name(const struct of_phandle_args *args, ...@@ -3200,12 +3201,11 @@ int snd_soc_get_dai_name(const struct of_phandle_args *args,
const char **dai_name) const char **dai_name)
{ {
struct snd_soc_component *pos; struct snd_soc_component *pos;
struct device_node *component_of_node;
int ret = -EPROBE_DEFER; int ret = -EPROBE_DEFER;
mutex_lock(&client_mutex); mutex_lock(&client_mutex);
for_each_component(pos) { for_each_component(pos) {
component_of_node = soc_component_to_node(pos); struct device_node *component_of_node = soc_component_to_node(pos);
if (component_of_node != args->np) if (component_of_node != args->np)
continue; continue;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment