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

Commit 2d855898 authored by Subbaraman Narayanamurthy's avatar Subbaraman Narayanamurthy
Browse files

power: qpnp-fg-gen4: Initialize work and mutex locks early



Currently, all the works are cancelled in fg_gen4_cleanup when it
is invoked when the driver probe fails. When the works are
cancelled even before they're initialized, a warning is printed
out from debug objects. Fix this by initializing them earlier.

Change-Id: Ibe73dd1e7f5aef65b30c331d7878b7dc83b85205
Signed-off-by: default avatarSubbaraman Narayanamurthy <subbaram@codeaurora.org>
parent 3fe40271
Loading
Loading
Loading
Loading
+10 −10
Original line number Diff line number Diff line
@@ -4166,6 +4166,16 @@ static int fg_gen4_probe(struct platform_device *pdev)
		return -ENXIO;
	}

	mutex_init(&fg->bus_lock);
	mutex_init(&fg->sram_rw_lock);
	mutex_init(&fg->charge_full_lock);
	init_completion(&fg->soc_update);
	init_completion(&fg->soc_ready);
	INIT_WORK(&fg->status_change_work, status_change_work);
	INIT_DELAYED_WORK(&fg->profile_load_work, profile_load_work);
	INIT_DELAYED_WORK(&fg->sram_dump_work, sram_dump_work);
	INIT_WORK(&chip->esr_calib_work, esr_calib_work);

	fg->awake_votable = create_votable("FG_WS", VOTE_SET_ANY,
					fg_awake_cb, fg);
	if (IS_ERR(fg->awake_votable)) {
@@ -4218,16 +4228,6 @@ static int fg_gen4_probe(struct platform_device *pdev)
		}
	}

	mutex_init(&fg->bus_lock);
	mutex_init(&fg->sram_rw_lock);
	mutex_init(&fg->charge_full_lock);
	init_completion(&fg->soc_update);
	init_completion(&fg->soc_ready);
	INIT_WORK(&fg->status_change_work, status_change_work);
	INIT_DELAYED_WORK(&fg->profile_load_work, profile_load_work);
	INIT_DELAYED_WORK(&fg->sram_dump_work, sram_dump_work);
	INIT_WORK(&chip->esr_calib_work, esr_calib_work);

	rc = fg_memif_init(fg);
	if (rc < 0) {
		dev_err(fg->dev, "Error in initializing FG_MEMIF, rc:%d\n",