asoc: codecs: Add default case for switch.
Add default case for switch to avoid the Null pointer dereference for the map and num_ports variable in for loop. Change-Id: I59c9dc6e5396bcb409876378c811143da1c81551 Signed-off-by: Prasad Kumpatla <nkumpat@codeaurora.org>
This commit is contained in:

committed by
Gerrit - the friendly Code Review server

parent
e7efdae360
commit
924c7d027c
@@ -164,6 +164,10 @@ static int wcd937x_set_port_params(struct snd_soc_component *component,
|
|||||||
map = &wcd937x->tx_port_mapping;
|
map = &wcd937x->tx_port_mapping;
|
||||||
num_ports = wcd937x->num_tx_ports;
|
num_ports = wcd937x->num_tx_ports;
|
||||||
break;
|
break;
|
||||||
|
default:
|
||||||
|
dev_err(component->dev, "%s Invalid path selected %u\n",
|
||||||
|
__func__, path);
|
||||||
|
return -EINVAL;
|
||||||
}
|
}
|
||||||
|
|
||||||
for (i = 0; i <= num_ports; i++) {
|
for (i = 0; i <= num_ports; i++) {
|
||||||
@@ -208,6 +212,10 @@ static int wcd937x_parse_port_mapping(struct device *dev,
|
|||||||
map = &wcd937x->tx_port_mapping;
|
map = &wcd937x->tx_port_mapping;
|
||||||
num_ports = &wcd937x->num_tx_ports;
|
num_ports = &wcd937x->num_tx_ports;
|
||||||
break;
|
break;
|
||||||
|
default:
|
||||||
|
dev_err(dev, "%s Invalid path selected %u\n",
|
||||||
|
__func__, path);
|
||||||
|
return -EINVAL;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!of_find_property(dev->of_node, prop,
|
if (!of_find_property(dev->of_node, prop,
|
||||||
|
Reference in New Issue
Block a user