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

Commit a45b5722 authored by Pratham Pratap's avatar Pratham Pratap
Browse files

usb: dwc3-msm: Initialize mutex before registering extcon



Right after registering extcon usb pd driver is notifying
extcon status which results in scheduling dwc3_otg_sm_work.
dwc3_otg_sm_work will call dwc3_msm_resume where we are
acquiring mutex to protect enabling phy irqs. By this time
there is a chance that mutex is not initialized yet. Then
it will be a race between initialization and acquiring of
mutex which will cause the core to loop forever. Fix this
by initializing mutex before registering extcon.

Change-Id: I84c4b958816421a83738ab7f6005adc7eaf083b1
Signed-off-by: default avatarPratham Pratap <prathampratap@codeaurora.org>
parent 8b7300fd
Loading
Loading
Loading
Loading
+1 −1
Original line number Original line Diff line number Diff line
@@ -3518,6 +3518,7 @@ static int dwc3_msm_probe(struct platform_device *pdev)
	mdwc->no_vbus_vote_type_c = of_property_read_bool(node,
	mdwc->no_vbus_vote_type_c = of_property_read_bool(node,
					"qcom,no-vbus-vote-with-type-C");
					"qcom,no-vbus-vote-with-type-C");


	mutex_init(&mdwc->suspend_resume_mutex);
	/* Mark type-C as true by default */
	/* Mark type-C as true by default */
	mdwc->type_c = true;
	mdwc->type_c = true;


@@ -3543,7 +3544,6 @@ static int dwc3_msm_probe(struct platform_device *pdev)
	if (ret)
	if (ret)
		goto put_psy;
		goto put_psy;


	mutex_init(&mdwc->suspend_resume_mutex);
	/* Update initial VBUS/ID state from extcon */
	/* Update initial VBUS/ID state from extcon */
	if (mdwc->extcon_vbus && extcon_get_state(mdwc->extcon_vbus,
	if (mdwc->extcon_vbus && extcon_get_state(mdwc->extcon_vbus,
							EXTCON_USB))
							EXTCON_USB))