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

Commit 7af6a8b6 authored by Shalini Manjunatha's avatar Shalini Manjunatha
Browse files

asoc: wcd938x/wcd937x: add null pointer check for mbhc variable



Whenever MBHC is disabled through kernel config file,
particular vaiable of mbhc is not guarded for NULL
pointer check causing kernel panic,
Hence add NULL check for that pointer variable.

Change-Id: Iae4950ceb076239a130b4f033cb2f08cd65a92a9
Signed-off-by: default avatarShalini Manjunatha <quic_c_shalma@quicinc.com>
parent 1ff3e5bc
Loading
Loading
Loading
Loading
+5 −3
Original line number Diff line number Diff line
@@ -1734,6 +1734,7 @@ static int wcd937x_event_notify(struct notifier_block *block,
	case BOLERO_SLV_EVT_SSR_DOWN:
		wcd937x->mbhc->wcd_mbhc.deinit_in_progress = true;
		mbhc = &wcd937x->mbhc->wcd_mbhc;
		if(mbhc->mbhc_cfg)
			wcd937x->usbc_hs_status = get_usbc_hs_status(component,
							mbhc->mbhc_cfg);
		wcd937x_mbhc_ssr_down(wcd937x->mbhc, component);
@@ -1755,6 +1756,7 @@ static int wcd937x_event_notify(struct notifier_block *block,
			dev_err(component->dev, "%s: mbhc initialization failed\n",
				__func__);
		} else {
			if(mbhc->mbhc_cfg)
				wcd937x_mbhc_hs_detect(component, mbhc->mbhc_cfg);
			if (wcd937x->usbc_hs_status)
				mdelay(500);
+5 −3
Original line number Diff line number Diff line
@@ -2161,6 +2161,7 @@ static int wcd938x_event_notify(struct notifier_block *block,
						     NULL);
		wcd938x->mbhc->wcd_mbhc.deinit_in_progress = true;
		mbhc = &wcd938x->mbhc->wcd_mbhc;
		if(mbhc->mbhc_cfg)
			wcd938x->usbc_hs_status = get_usbc_hs_status(component,
							mbhc->mbhc_cfg);
		wcd938x_mbhc_ssr_down(wcd938x->mbhc, component);
@@ -2184,6 +2185,7 @@ static int wcd938x_event_notify(struct notifier_block *block,
			dev_err(component->dev, "%s: mbhc initialization failed\n",
				__func__);
		} else {
			if(mbhc->mbhc_cfg)
				wcd938x_mbhc_hs_detect(component, mbhc->mbhc_cfg);
		}
		wcd938x->mbhc->wcd_mbhc.deinit_in_progress = false;