Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752528AbaDZLmp (ORCPT ); Sat, 26 Apr 2014 07:42:45 -0400 Received: from mailout3.samsung.com ([203.254.224.33]:57122 "EHLO mailout3.samsung.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751770AbaDZLjm (ORCPT ); Sat, 26 Apr 2014 07:39:42 -0400 X-AuditID: cbfee68d-b7f4e6d000004845-5c-535b9afc9757 From: Naveen Krishna Chatradhi To: linux-iio@vger.kernel.org Cc: linux-kernel@vger.kernel.org, linux-samsung-soc@vger.kernel.org, dianders@chromium.org, gregkh@linuxfoundation.org, naveenkrishna.ch@gmail.com, lars@metafoo.de, cpgs@samsung.com, grundler@chromium.org, jic23@kernel.org, Naveen Krishna Ch Subject: [PATCH 1/5 v2] iio: exynos_adc: use indio_dev->dev structure to handle child nodes Date: Sat, 26 Apr 2014 17:07:52 +0530 Message-id: <1398512276-4105-2-git-send-email-ch.naveen@samsung.com> X-Mailer: git-send-email 1.7.9.5 In-reply-to: <1398512276-4105-1-git-send-email-ch.naveen@samsung.com> References: <1398512276-4105-1-git-send-email-ch.naveen@samsung.com> X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFprEIsWRmVeSWpSXmKPExsWyRsSkTvfvrOhgg1d72SzuPj/MaPHykKbF 2WUH2SyaF69ns3h15AeTxYOmVUwWSybPZ7WYd+Qdi8XlXXPYLGac38dksWjbf2YHbo/ZDRdZ PHbOusvusWlVJ5vH/rlr2D2WvDnE6tG3ZRWjx+dNcgHsUVw2Kak5mWWpRfp2CVwZXa3f2Qo2 81ecWbyavYFxIm8XIyeHhICJRMPuVcwQtpjEhXvr2boYuTiEBJYySlw5cZcJpujDy9ksEInp jBL/p75hhXD6mSSWn/gFVsUmYCZxcNFq9i5GDg4RAVmJmd16IDXMIDUNTy8ygsSFBWIlTh9m BSlnEVCV6OxYCtbKK+Ai8XX6GWaQEgkBBYk5k2xAwpwCrhITF10FKxECKnk78T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cQb GpuYmxqbWppYmJhZkiasJM57oNU6UEggPbEkNTs1tSC1CGYLEwenVANjSk1E7vL31XffK/4o DXkhVvqdN/Oics0SRocT2tfOWL/68Ub66OSeWVGMF+b5TdK5/J1r95yWR+4fcvc2Tt14s3Xf rPKZZX7v9OyMu+X8+v3KREQfn+ks6apomfNhS/i7zctDhb9p17SIV81Ke/dnaTnDSseiHke2 CaYsa7aa5UbvWnvx449GJZbijERDLeai4kQAKl1uEgIDAAA= DLP-Filter: Pass X-MTR: 20000000000000000@CPGS X-CFilter-Loop: Reflected Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Naveen Krishna Ch Using pdev->dev with device_for_each_child() would iterate over all of the children of the platform device and delete them. Thus, causing crashes during module unload. We should be using the indio_dev->dev structure for registering/unregistering child nodes. Signed-off-by: Naveen Krishna Ch Reported-by: Doug Anderson Reviewed-by: Doug Anderson Tested-by: Doug Anderson --- This change was tested on top of https://lkml.org/lkml/2014/4/21/481 from Doug. drivers/iio/adc/exynos_adc.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/drivers/iio/adc/exynos_adc.c b/drivers/iio/adc/exynos_adc.c index d25b262..affa93f 100644 --- a/drivers/iio/adc/exynos_adc.c +++ b/drivers/iio/adc/exynos_adc.c @@ -344,7 +344,7 @@ static int exynos_adc_probe(struct platform_device *pdev) exynos_adc_hw_init(info); - ret = of_platform_populate(np, exynos_adc_match, NULL, &pdev->dev); + ret = of_platform_populate(np, exynos_adc_match, NULL, &indio_dev->dev); if (ret < 0) { dev_err(&pdev->dev, "failed adding child nodes\n"); goto err_of_populate; @@ -353,7 +353,7 @@ static int exynos_adc_probe(struct platform_device *pdev) return 0; err_of_populate: - device_for_each_child(&pdev->dev, NULL, + device_for_each_child(&indio_dev->dev, NULL, exynos_adc_remove_devices); regulator_disable(info->vdd); clk_disable_unprepare(info->clk); @@ -369,7 +369,7 @@ static int exynos_adc_remove(struct platform_device *pdev) struct iio_dev *indio_dev = platform_get_drvdata(pdev); struct exynos_adc *info = iio_priv(indio_dev); - device_for_each_child(&pdev->dev, NULL, + device_for_each_child(&indio_dev->dev, NULL, exynos_adc_remove_devices); regulator_disable(info->vdd); clk_disable_unprepare(info->clk); -- 1.7.9.5 -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/