From mboxrd@z Thu Jan 1 00:00:00 1970 From: m.szyprowski@samsung.com (Marek Szyprowski) Date: Mon, 18 Jul 2016 09:34:11 +0200 Subject: [PATCH -next] iommu/exynos: Fix return value check in exynos_iommu_of_setup() In-Reply-To: <577D0316.1050502@samsung.com> References: <1467807354-26503-1-git-send-email-weiyj_lk@163.com> <577D0316.1050502@samsung.com> Message-ID: <7d4c2517-5149-30d8-eeff-2bd7519dfdf3@samsung.com> To: linux-arm-kernel@lists.infradead.org List-Id: linux-arm-kernel.lists.infradead.org Hello, On 2016-07-06 15:09, Krzysztof Kozlowski wrote: > On 07/06/2016 02:15 PM, weiyj_lk at 163.com wrote: >> From: Wei Yongjun >> >> In case of error, the function of_platform_device_create() returns >> NULL pointer not ERR_PTR(). The IS_ERR() test in the return value >> check should be replaced with NULL test. >> >> Signed-off-by: Wei Yongjun >> --- >> drivers/iommu/exynos-iommu.c | 4 ++-- >> 1 file changed, 2 insertions(+), 2 deletions(-) >> >> diff --git a/drivers/iommu/exynos-iommu.c b/drivers/iommu/exynos-iommu.c >> index 33dcc29..9b23059 100644 >> --- a/drivers/iommu/exynos-iommu.c >> +++ b/drivers/iommu/exynos-iommu.c >> @@ -1345,8 +1345,8 @@ static int __init exynos_iommu_of_setup(struct device_node *np) >> exynos_iommu_init(); >> >> pdev = of_platform_device_create(np, NULL, platform_bus_type.dev_root); >> - if (IS_ERR(pdev)) >> - return PTR_ERR(pdev); >> + if (!pdev) >> + return -ENOMEM; >> >> /* >> * use the first registered sysmmu device for performing >> > Reviewed-by: Krzysztof Kozlowski > > > Which in case of first sysmmu device and of_platform_device_create() > failure will lead to NULL pointer exception, so I think it is > appropriate to: > Fixes: 8ed55c812fa8 ("iommu/exynos: Init from dt-specific callback > instead of initcall") > Cc: Thanks for spotting this issue. Acked-by: Marek Szyprowski Best regards -- Marek Szyprowski, PhD Samsung R&D Institute Poland