asoc: codecs: Add proper null checks and initialize variables

Add proper null checks and initialize variables
in rx-macro, tx-macro, va-macro and wcd937x drivers.

Change-Id: I90899c84d3391305b9a24d4b043adc08b7c0332a
Signed-off-by: Tanya Dixit <tdixit@codeaurora.org>
diff --git a/asoc/codecs/bolero/rx-macro.c b/asoc/codecs/bolero/rx-macro.c
index 006f863..1a618d0 100644
--- a/asoc/codecs/bolero/rx-macro.c
+++ b/asoc/codecs/bolero/rx-macro.c
@@ -770,6 +770,11 @@
 	struct regmap *regmap = dev_get_regmap(rx_priv->dev->parent, NULL);
 	int ret = 0, mclk_mux = MCLK_MUX0;
 
+	if (regmap == NULL) {
+		dev_err(rx_priv->dev, "%s: regmap is NULL\n", __func__);
+		return -EINVAL;
+	}
+
 	dev_dbg(rx_priv->dev, "%s: mclk_enable = %u, dapm = %d clk_users= %d\n",
 		__func__, mclk_enable, dapm, rx_priv->rx_mclk_users);
 
@@ -1570,6 +1575,11 @@
 	u16 reg_add = 0, coeff_idx = 0, idx = 0;
 	struct regmap *regmap = dev_get_regmap(rx_priv->dev->parent, NULL);
 
+	if (regmap == NULL) {
+		dev_err(rx_priv->dev, "%s: regmap is NULL\n", __func__);
+		return;
+	}
+
 	regmap_write(regmap,
 		(BOLERO_CDC_RX_SIDETONE_IIR0_IIR_COEF_B1_CTL + 0x80 * iir_idx),
 		(band_idx * BAND_MAX * sizeof(uint32_t)) & 0x7F);
@@ -2383,6 +2393,11 @@
 	struct regmap *regmap = dev_get_regmap(rx_priv->dev->parent, NULL);
 	int ret = 0;
 
+	if (regmap == NULL) {
+		dev_err(rx_priv->dev, "%s: regmap is NULL\n", __func__);
+		return -EINVAL;
+	}
+
 	mutex_lock(&rx_priv->swr_clk_lock);
 
 	dev_dbg(rx_priv->dev, "%s: swrm clock %s\n",