From patchwork Mon Aug 1 06:18:38 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Amitoj Kaur Chawla X-Patchwork-Id: 9253845 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id AB3746048B for ; Mon, 1 Aug 2016 07:17:13 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 983BA2849B for ; Mon, 1 Aug 2016 07:17:13 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 8C8A32849D; Mon, 1 Aug 2016 07:17:13 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.8 required=2.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED, FREEMAIL_FROM, RCVD_IN_DNSWL_HI, T_DKIM_INVALID autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 465B92849B for ; Mon, 1 Aug 2016 07:17:13 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751342AbcHAHPY (ORCPT ); Mon, 1 Aug 2016 03:15:24 -0400 Received: from mail-pa0-f66.google.com ([209.85.220.66]:34373 "EHLO mail-pa0-f66.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750912AbcHAHPS (ORCPT ); Mon, 1 Aug 2016 03:15:18 -0400 Received: by mail-pa0-f66.google.com with SMTP id hh10so9438030pac.1; Mon, 01 Aug 2016 00:15:18 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=date:from:to:cc:subject:message-id:mime-version:content-disposition :user-agent; bh=vXGbha1Tyv9Ok+H90GqvmvtK9q4EggdzKLjzb8HvYIM=; b=wXc7v8wVf9hNtXA7qr8PnHcGmWWVxEn+RdtmGZuuZLKZ4cMUcy4wODrk3F1MPIt+dt hqX5jRftWWXeCHUWFprG4yWKylRti8z7QWklIfPm5hsqoyrx4emm2eYEFhSTcQ+NuhNu 11Odv3IsRMO0cYVhlyophYNkSVlPHc7iqTBg758VwIbOOWzbTjDgCVXgzwV4HtLtVZeV XFSPcCqEH11wvbUQqBL7MKpReINgjt1EC8WwIoi/Vzw9fAApkiprRwKHshC5zW8P7Q85 pf1MRYMNkpneu90VT07C9IfrdYulL9Kz9XRuS2FC8SsSuX+uVnm9gSGzDot3pLizVap/ 4YLQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:date:from:to:cc:subject:message-id:mime-version :content-disposition:user-agent; bh=vXGbha1Tyv9Ok+H90GqvmvtK9q4EggdzKLjzb8HvYIM=; b=dyOT22AlD7SY5kaPv8vLlDU+a7IKDIaW1syDCsIuV6bPUpqwX6JySMHSo37n/eHOCY AF6HFCHJFFp8RtT1O8gIn/W1xlBp0mNT9S2JPWgBpIAVFxImDp0X2151wWKkMnKInbBz uapozNmx/kD310XNvr+BRWLKZLd1nf5zcfjQ99GQlPoIuMu9Rcqq/QW0ErAQ4g5M2IQX gtn1S2piTlaWaF/g12iCXSl2tkv1HJ/iEGUPsyNm0EJWxzn4mWL9BkE9nhdxjvYiAToy m+s8Gw3XTDzyoizJVwgqvtaSU+DTAZhB0bUT9wM75sGiUrwfCr2GDj5gpB30nUjxCD4x 5NnQ== X-Gm-Message-State: AEkoouvHy3yDpw1MWcSpags0ujbSJuoBeGJRNk5uEEFfqfbDAumB35aN7uaz3Zf8upjU/w== X-Received: by 10.67.7.9 with SMTP id cy9mr88046804pad.155.1470032322693; Sun, 31 Jul 2016 23:18:42 -0700 (PDT) Received: from localhost ([117.99.176.24]) by smtp.gmail.com with ESMTPSA id 15sm42182716pfz.36.2016.07.31.23.18.41 (version=TLS1_2 cipher=AES128-SHA bits=128/128); Sun, 31 Jul 2016 23:18:42 -0700 (PDT) Date: Mon, 1 Aug 2016 11:48:38 +0530 From: Amitoj Kaur Chawla To: joro@8bytes.org, kgene@kernel.org, k.kozlowski@samsung.com, iommu@lists.linux-foundation.org, linux-arm-kernel@lists.infradead.org, linux-samsung-soc@vger.kernel.org, linux-kernel@vger.kernel.org Cc: julia.lawall@lip6.fr Subject: [PATCH] iommu/exynos: Modify error handling Message-ID: <20160801061838.GA17805@amitoj-Inspiron-3542> MIME-Version: 1.0 Content-Disposition: inline User-Agent: Mutt/1.5.21 (2010-09-15) Sender: linux-samsung-soc-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-samsung-soc@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP of_platform_device_create returns NULL on error so an IS_ERR test is incorrect here and a NULL check is required. The Coccinelle semantic patch used to make this change is as follows: @@ expression e; @@ e = of_platform_device_create(...); if( - IS_ERR(e) + !e ) { <+... return - PTR_ERR(e) + -ENODEV ; ...+> } Signed-off-by: Amitoj Kaur Chawla --- 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 97c41b8..2888bbf 100644 --- a/drivers/iommu/exynos-iommu.c +++ b/drivers/iommu/exynos-iommu.c @@ -1242,8 +1242,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 -ENODEV; of_iommu_set_ops(np, &exynos_iommu_ops); return 0;