Skip to contentSkip to conversation

iio: aspeed_adc: Fix prescaler devres cleanup

PATCH New Joel Stanley 1 participant 1 message Oct 5, 2021

Subsystems (2)
lore
Share & tools
lore

Joel Stanley

author maintainer
#0 lore raw

PATCH 1/1 iio: aspeed_adc: Fix prescaler devres cleanup

A devres hook is added for aspeed_adc_unregister_fixed_divider that should pass a pointer to the fixed divider. It mistakenly had a pointer to a different clock, leading to a null pointer dereference.

This change was included in v7 of the patches submitted upstream.

Fixes ec35bd77c642 ("iio: adc: aspeed: Fix the calculate error of clock.")
---
 drivers/iio/adc/aspeed_adc.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/iio/adc/aspeed_adc.c +2 -2
index d4d8ac07d40d..3e9850a43372 100644
@@ -492,8 +492,8 @@ static int aspeed_adc_probe(struct platform_device *pdev)
 
 	data = iio_priv(indio_dev);
 	data->dev = &pdev->dev;
-	data->model_data = of_device_get_match_data(&pdev->dev);
 	platform_set_drvdata(pdev, indio_dev);
+	data->model_data = of_device_get_match_data(&pdev->dev);
 
 	data->base = devm_platform_ioremap_resource(pdev, 0);
 	if (IS_ERR(data->base))
@@ -512,7 +512,7 @@ static int aspeed_adc_probe(struct platform_device *pdev)
 
 	ret = devm_add_action_or_reset(data->dev,
 				       aspeed_adc_unregister_fixed_divider,
-				       data->clk_prescaler);
+				       data->fixed_div_clk);
 	if (ret)
 		return ret;
 	snprintf(clk_parent_name, ARRAY_SIZE(clk_parent_name), clk_name);
Signature · 1 line
2.33.0