Merge "asoc: codecs: bolero: Add checks before accessing allocated pointer"
diff --git a/asoc/codecs/wcd937x/wcd937x.c b/asoc/codecs/wcd937x/wcd937x.c
index fcc4e6f..bde3a7e 100644
--- a/asoc/codecs/wcd937x/wcd937x.c
+++ b/asoc/codecs/wcd937x/wcd937x.c
@@ -134,6 +134,12 @@
 	snd_soc_component_update_bits(component,
 				WCD937X_HPH_SURGE_HPHLR_SURGE_EN,
 				0xFF, 0xD9);
+	snd_soc_component_update_bits(component, WCD937X_MICB1_TEST_CTL_1,
+				0xFF, 0xFA);
+	snd_soc_component_update_bits(component, WCD937X_MICB2_TEST_CTL_1,
+				0xFF, 0xFA);
+	snd_soc_component_update_bits(component, WCD937X_MICB3_TEST_CTL_1,
+				0xFF, 0xFA);
 	return 0;
 }
 
diff --git a/asoc/codecs/wcd938x/wcd938x.c b/asoc/codecs/wcd938x/wcd938x.c
index ca20bc4..6241cf2 100644
--- a/asoc/codecs/wcd938x/wcd938x.c
+++ b/asoc/codecs/wcd938x/wcd938x.c
@@ -1655,13 +1655,20 @@
 			snd_soc_dapm_kcontrol_widget(kcontrol);
 	struct snd_soc_component *component =
 			snd_soc_kcontrol_component(kcontrol);
-	struct wcd938x_priv *wcd938x = snd_soc_component_get_drvdata(component);
-	u32 path = 0;
+	struct wcd938x_priv *wcd938x = NULL;
+	int path = 0;
 
-	if (!widget || !widget->name || !wcd938x || !component)
+	if (!component)
+		return -EINVAL;
+
+	wcd938x = snd_soc_component_get_drvdata(component);
+
+	if (!widget || !widget->name || !wcd938x)
 		return -EINVAL;
 
 	path = wcd938x_tx_path_get(widget->name);
+	if (path < 0 || path >= TX_ADC_MAX)
+		return -EINVAL;
 
 	ucontrol->value.integer.value[0] = wcd938x->tx_mode[path];
 
@@ -1675,14 +1682,22 @@
 			snd_soc_dapm_kcontrol_widget(kcontrol);
 	struct snd_soc_component *component =
 			snd_soc_kcontrol_component(kcontrol);
-	struct wcd938x_priv *wcd938x = snd_soc_component_get_drvdata(component);
+	struct wcd938x_priv *wcd938x = NULL;
 	u32 mode_val;
-	u32 path = 0;
+	int path = 0;
 
-	if (!widget || !widget->name || !wcd938x || !component)
+	if (!component)
+		return -EINVAL;
+
+	wcd938x  = snd_soc_component_get_drvdata(component);
+
+	if (!widget || !widget->name || !wcd938x)
 		return -EINVAL;
 
 	path = wcd938x_tx_path_get(widget->name);
+	if (path < 0 || path >= TX_ADC_MAX)
+		return -EINVAL;
+
 	mode_val = ucontrol->value.enumerated.item[0];
 
 	dev_dbg(component->dev, "%s: mode: %d\n", __func__, mode_val);
diff --git a/soc/swr-mstr-ctrl.c b/soc/swr-mstr-ctrl.c
index bddf30a..17fc1c6 100644
--- a/soc/swr-mstr-ctrl.c
+++ b/soc/swr-mstr-ctrl.c
@@ -2293,7 +2293,12 @@
 			enable_bank_switch(swrm, 0, SWR_ROW_50, SWR_MIN_COL);
 			list_for_each_entry(swr_dev, &mstr->devices, dev_list) {
 				ret = swr_device_up(swr_dev);
-				if (ret) {
+				if (ret == -ENODEV) {
+					dev_dbg(dev,
+						"%s slave device up not implemented\n",
+						__func__);
+					ret = 0;
+				} else if (ret) {
 					dev_err(dev,
 						"%s: failed to wakeup swr dev %d\n",
 						__func__, swr_dev->dev_num);
@@ -2358,7 +2363,12 @@
 			swr_master_write(swrm, SWRM_COMP_CFG_ADDR, 0x00);
 			list_for_each_entry(swr_dev, &mstr->devices, dev_list) {
 				ret = swr_device_down(swr_dev);
-				if (ret) {
+				if (ret == -ENODEV) {
+					dev_dbg_ratelimited(dev,
+						"%s slave device down not implemented\n",
+						__func__);
+					ret = 0;
+				} else if (ret) {
 					dev_err(dev,
 						"%s: failed to shutdown swr dev %d\n",
 						__func__, swr_dev->dev_num);