Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 8422a920 authored by Linux Build Service Account's avatar Linux Build Service Account Committed by Gerrit - the friendly Code Review server
Browse files

Merge "ASoC: msm8x16-wcd: Avoid null pointer spmi access"

parents ece0956b f06b79bf
Loading
Loading
Loading
Loading
+20 −11
Original line number Diff line number Diff line
@@ -5874,6 +5874,7 @@ static int msm8x16_wcd_spmi_probe(struct spmi_device *spmi)
	struct msm8x16_wcd_pdata *pdata;
	struct resource *wcd_resource;
	int adsp_state;
	static int spmi_dev_registered_cnt;

	dev_dbg(&spmi->dev, "%s(%d):slave ID = 0x%x\n",
		__func__, __LINE__,  spmi->sid);
@@ -5911,7 +5912,8 @@ static int msm8x16_wcd_spmi_probe(struct spmi_device *spmi)
		dev_dbg(&spmi->dev,
				"%s: irq initialization passed\n", __func__);
	}
		goto rtn;
		spmi_dev_registered_cnt++;
		goto register_codec;
	default:
		ret = -EINVAL;
		goto rtn;
@@ -5973,17 +5975,24 @@ static int msm8x16_wcd_spmi_probe(struct spmi_device *spmi)
		goto err_supplies;
	}
	dev_set_drvdata(&spmi->dev, msm8x16);

	ret = snd_soc_register_codec(&spmi->dev, &soc_codec_dev_msm8x16_wcd,
	spmi_dev_registered_cnt++;
register_codec:
	if ((spmi_dev_registered_cnt == MAX_MSM8X16_WCD_DEVICE) && (!ret)) {
		if (msm8x16_wcd_modules[0].spmi) {
			ret = snd_soc_register_codec(
					&msm8x16_wcd_modules[0].spmi->dev,
					&soc_codec_dev_msm8x16_wcd,
					msm8x16_wcd_i2s_dai,
					ARRAY_SIZE(msm8x16_wcd_i2s_dai));
			if (ret) {
				dev_err(&spmi->dev,
				"%s:snd_soc_register_codec failed with error %d\n",
				__func__, ret);
	} else {
		goto rtn;
				goto err_supplies;
			}
		}
	}
	return ret;
err_supplies:
	msm8x16_wcd_disable_supplies(msm8x16, pdata);
err_codec: