Received: by 2002:ac0:a5a6:0:0:0:0:0 with SMTP id m35-v6csp6394966imm; Mon, 27 Aug 2018 15:15:16 -0700 (PDT) X-Google-Smtp-Source: ANB0VdbXGkI9FTM08e7VOKP33+YT0XMqJwO47iwI4DNQPPsqJU1O/lGoEx842fUJPAIPHp6oiREd X-Received: by 2002:a63:fc54:: with SMTP id r20-v6mr7980812pgk.377.1535408116459; Mon, 27 Aug 2018 15:15:16 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1535408116; cv=none; d=google.com; s=arc-20160816; b=xFS38mZHC4EwTcxrmI9efDlCvfTOPp/fL25uI7ZVUTZjCUuI4Co9t7kH2n5lV86sxv EKqESEfyD2ZsV4gXj7ETIJNNcaJMFxShN4AuluJFhoUU/ZxWDIUMfTwT+V2k1EUSdp51 fxpPqIXh5XEsaxko7kOKY0M/hJU21AiPmN5hrz2iwN+Z6vj8ZJAJ7Uxm2Z+y6nRmgJRZ /jQM/SPkMJkhGTc4Bih2HcOLIi9p4czj/uzTuDFIdCqwhhF9hNojLr3QRPZrFLwcyj49 gT25mLo7Z87OxeNjgc8/MRv6E+lpKv2HNgB3iNW9O+NJOQfbfH3j+AzSaquhxzT4ivNc VaYg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:content-disposition :mime-version:message-id:subject:cc:to:from:date :arc-authentication-results; bh=fV8eVbeygRTjuHvKqtdoymqwhrowifFqPL9ZLZLBapw=; b=YD2CxTza5UFaq6QnbaqinbhpOzTQVzdcA3u9WoSRrGQhvXiVirYAeovdv/76uFGuw1 nnp7Wv/+ZFs8+P2g/4R1A1v6KYKzZvJWmT2K70QxZvK/nXbNghAMklFDDqm7V1q/aFFB XOOm7nttkHmTjlHHjwo+eYs95je5Ng1EKcnz9UFJDpxub63Iz955ZYEIU0cpNysaMTUI LktnAg3y2ox7Fqf0U4kKQU+K2LrSFCRKlaMXLYezUJSsAB0kzeRBNxRTUqKrzJYvNEGW AP1tVV4BHHJl+TQAnphmCtxb7OXHjAlGS+nmPQByvO228ymeqgqXJwsfkzhVn/nVWpIt efkg== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id y22-v6si402540pgj.436.2018.08.27.15.14.59; Mon, 27 Aug 2018 15:15:16 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727201AbeH1CCW (ORCPT + 99 others); Mon, 27 Aug 2018 22:02:22 -0400 Received: from gateway21.websitewelcome.com ([192.185.45.228]:45649 "EHLO gateway21.websitewelcome.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727023AbeH1CCW (ORCPT ); Mon, 27 Aug 2018 22:02:22 -0400 Received: from cm10.websitewelcome.com (cm10.websitewelcome.com [100.42.49.4]) by gateway21.websitewelcome.com (Postfix) with ESMTP id 5B378400CA748 for ; Mon, 27 Aug 2018 17:13:49 -0500 (CDT) Received: from gator4166.hostgator.com ([108.167.133.22]) by cmsmtp with SMTP id uPkzfp6pkBcCXuPlMfJilU; Mon, 27 Aug 2018 17:13:48 -0500 X-Authority-Reason: nr=8 Received: from [189.250.132.202] (port=54620 helo=embeddedor) by gator4166.hostgator.com with esmtpa (Exim 4.91) (envelope-from ) id 1fuPky-002e8a-Oc; Mon, 27 Aug 2018 17:13:08 -0500 Date: Mon, 27 Aug 2018 17:13:06 -0500 From: "Gustavo A. R. Silva" To: Serge Semin , Jon Mason , Dave Jiang , Allen Hubbe Cc: linux-ntb@googlegroups.com, linux-kernel@vger.kernel.org, "Gustavo A. R. Silva" Subject: [PATCH] NTB: ntb_hw_idt: replace IS_ERR_OR_NULL with regular NULL checks Message-ID: <20180827221306.GA8936@embeddedor.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline User-Agent: Mutt/1.5.24 (2015-08-30) X-AntiAbuse: This header was added to track abuse, please include it with any abuse report X-AntiAbuse: Primary Hostname - gator4166.hostgator.com X-AntiAbuse: Original Domain - vger.kernel.org X-AntiAbuse: Originator/Caller UID/GID - [47 12] / [47 12] X-AntiAbuse: Sender Address Domain - embeddedor.com X-BWhitelist: no X-Source-IP: 189.250.132.202 X-Source-L: No X-Exim-ID: 1fuPky-002e8a-Oc X-Source: X-Source-Args: X-Source-Dir: X-Source-Sender: (embeddedor) [189.250.132.202]:54620 X-Source-Auth: gustavo@embeddedor.com X-Email-Count: 6 X-Source-Cap: Z3V6aWRpbmU7Z3V6aWRpbmU7Z2F0b3I0MTY2Lmhvc3RnYXRvci5jb20= X-Local-Domain: yes Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Both devm_kcalloc() and devm_kzalloc() return NULL on error. They never return error pointers. The use of IS_ERR_OR_NULL is currently applied to the wrong context. Fix this by replacing IS_ERR_OR_NULL with regular NULL checks. Fixes: bf2a952d31d2 ("NTB: Add IDT 89HPESxNTx PCIe-switches support") Signed-off-by: Gustavo A. R. Silva --- drivers/ntb/hw/idt/ntb_hw_idt.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/drivers/ntb/hw/idt/ntb_hw_idt.c b/drivers/ntb/hw/idt/ntb_hw_idt.c index dbe72f1..a67ef23 100644 --- a/drivers/ntb/hw/idt/ntb_hw_idt.c +++ b/drivers/ntb/hw/idt/ntb_hw_idt.c @@ -1105,9 +1105,9 @@ static struct idt_mw_cfg *idt_scan_mws(struct idt_ntb_dev *ndev, int port, } /* Allocate memory for memory window descriptors */ - ret_mws = devm_kcalloc(&ndev->ntb.pdev->dev, *mw_cnt, - sizeof(*ret_mws), GFP_KERNEL); - if (IS_ERR_OR_NULL(ret_mws)) + ret_mws = devm_kcalloc(&ndev->ntb.pdev->dev, *mw_cnt, sizeof(*ret_mws), + GFP_KERNEL); + if (!ret_mws) return ERR_PTR(-ENOMEM); /* Copy the info of detected memory windows */ @@ -2390,7 +2390,7 @@ static struct idt_ntb_dev *idt_create_dev(struct pci_dev *pdev, /* Allocate memory for the IDT PCIe-device descriptor */ ndev = devm_kzalloc(&pdev->dev, sizeof(*ndev), GFP_KERNEL); - if (IS_ERR_OR_NULL(ndev)) { + if (!ndev) { dev_err(&pdev->dev, "Memory allocation failed for descriptor"); return ERR_PTR(-ENOMEM); } -- 2.7.4