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

Commit 48736c80 authored by Axel Lin's avatar Axel Lin Committed by Samuel Ortiz
Browse files

mfd: Fix jz4740-adc resource reclaim in probe error path



If mfd_add_devices() fail, we need to relese allocated resources.

Signed-off-by: default avatarAxel Lin <axel.lin@gmail.com>
Signed-off-by: default avatarSamuel Ortiz <sameo@linux.intel.com>
parent 88913521
Loading
Loading
Loading
Loading
+7 −1
Original line number Original line Diff line number Diff line
@@ -322,9 +322,15 @@ static int __devinit jz4740_adc_probe(struct platform_device *pdev)
	writeb(0x00, adc->base + JZ_REG_ADC_ENABLE);
	writeb(0x00, adc->base + JZ_REG_ADC_ENABLE);
	writeb(0xff, adc->base + JZ_REG_ADC_CTRL);
	writeb(0xff, adc->base + JZ_REG_ADC_CTRL);


	return mfd_add_devices(&pdev->dev, 0, jz4740_adc_cells,
	ret = mfd_add_devices(&pdev->dev, 0, jz4740_adc_cells,
		ARRAY_SIZE(jz4740_adc_cells), mem_base, adc->irq_base);
		ARRAY_SIZE(jz4740_adc_cells), mem_base, adc->irq_base);
	if (ret < 0)
		goto err_clk_put;


	return 0;

err_clk_put:
	clk_put(adc->clk);
err_iounmap:
err_iounmap:
	platform_set_drvdata(pdev, NULL);
	platform_set_drvdata(pdev, NULL);
	iounmap(adc->base);
	iounmap(adc->base);