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

Commit 801c57e6 authored by Karthikeyan Mani's avatar Karthikeyan Mani
Browse files

ASoC: wsa881x: Fix GPIO leak issue



In case of any probe/logical address error,
set the pinctrl of wsa881x to the state that
it was before the probe entered. Otherwise
set it to active state.

CRs-fixed: 2050725
Change-Id: I5022885f36111caeac1d25017db8a474e26ca521
Signed-off-by: default avatarKarthikeyan Mani <kmani@codeaurora.org>
parent bf78d4bc
Loading
Loading
Loading
Loading
+6 −0
Original line number Diff line number Diff line
@@ -1154,6 +1154,7 @@ static int wsa881x_swr_probe(struct swr_device *pdev)
	int ret = 0;
	struct wsa881x_priv *wsa881x;
	u8 devnum = 0;
	bool pin_state_current = false;

	wsa881x = devm_kzalloc(&pdev->dev, sizeof(struct wsa881x_priv),
			    GFP_KERNEL);
@@ -1184,6 +1185,9 @@ static int wsa881x_swr_probe(struct swr_device *pdev)
		if (ret)
			goto err;
	}
	if (wsa881x->wsa_rst_np)
		pin_state_current = msm_cdc_pinctrl_get_state(
						wsa881x->wsa_rst_np);
	wsa881x_gpio_ctrl(wsa881x, true);
	wsa881x->state = WSA881X_DEV_UP;

@@ -1246,6 +1250,8 @@ static int wsa881x_swr_probe(struct swr_device *pdev)
	return 0;

dev_err:
	if (pin_state_current == false)
		wsa881x_gpio_ctrl(wsa881x, false);
	swr_remove_device(pdev);
err:
	return ret;