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

Commit 68b87247 authored by Jishnu Prakash's avatar Jishnu Prakash
Browse files

hwmon: qpnp-adc: Change initialization order of adc_tm struct members



During the adc_tm probe, when channels register with the thermal
framework, as part of registration, thermal driver tries to set
trip thresholds using adc_tm function. If initializations in this
change are not done early enough, qpnp_adc_tm_set_trip_temp fails
chip validation and returns error early.

Initialize some adc_tm structure members earlier to avoid errors
during thermal registration.

Change-Id: Ia1d0231403e6289c9b0e43e638677b50709c5182
Signed-off-by: default avatarJishnu Prakash <jprakash@codeaurora.org>
parent 4c446fd4
Loading
Loading
Loading
Loading
+4 −2
Original line number Diff line number Diff line
@@ -2959,6 +2959,9 @@ static int qpnp_adc_tm_probe(struct platform_device *pdev)
	if (!chip)
		return -ENOMEM;

	list_add(&chip->list, &qpnp_adc_tm_device_list);
	chip->max_channels_available = count_adc_channel_list;

	adc_qpnp = devm_kzalloc(&pdev->dev, sizeof(struct qpnp_adc_drv),
			GFP_KERNEL);
	if (!adc_qpnp) {
@@ -3090,7 +3093,6 @@ static int qpnp_adc_tm_probe(struct platform_device *pdev)
		INIT_LIST_HEAD(&chip->sensor[sen_idx].thr_list);
		sen_idx++;
	}
	chip->max_channels_available = count_adc_channel_list;

	chip->high_thr_wq = alloc_workqueue("qpnp_adc_tm_high_thr_wq",
							WQ_HIGHPRI, 0);
@@ -3153,7 +3155,6 @@ static int qpnp_adc_tm_probe(struct platform_device *pdev)

	chip->adc_vote_enable = false;
	dev_set_drvdata(&pdev->dev, chip);
	list_add(&chip->list, &qpnp_adc_tm_device_list);
	spin_lock_init(&chip->th_info.adc_tm_low_lock);
	spin_lock_init(&chip->th_info.adc_tm_high_lock);

@@ -3173,6 +3174,7 @@ static int qpnp_adc_tm_probe(struct platform_device *pdev)
		destroy_workqueue(chip->high_thr_wq);
	if (chip->low_thr_wq)
		destroy_workqueue(chip->low_thr_wq);
	list_del(&chip->list);
	dev_set_drvdata(&pdev->dev, NULL);
	return rc;
}