From patchwork Wed Dec 23 12:53:58 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Julia Lawall X-Patchwork-Id: 560510 X-Patchwork-Delegate: jeffrey.t.kirsher@intel.com Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from whitealder.osuosl.org (smtp1.osuosl.org [140.211.166.138]) by ozlabs.org (Postfix) with ESMTP id 517DF140BEE for ; Wed, 23 Dec 2015 23:54:13 +1100 (AEDT) Received: from localhost (localhost [127.0.0.1]) by whitealder.osuosl.org (Postfix) with ESMTP id 514739265A; Wed, 23 Dec 2015 12:54:12 +0000 (UTC) X-Virus-Scanned: amavisd-new at osuosl.org Received: from whitealder.osuosl.org ([127.0.0.1]) by localhost (.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id i6dp2tGU9weI; Wed, 23 Dec 2015 12:54:11 +0000 (UTC) Received: from ash.osuosl.org (ash.osuosl.org [140.211.166.34]) by whitealder.osuosl.org (Postfix) with ESMTP id 6933D9264D; Wed, 23 Dec 2015 12:54:11 +0000 (UTC) X-Original-To: intel-wired-lan@lists.osuosl.org Delivered-To: intel-wired-lan@lists.osuosl.org Received: from hemlock.osuosl.org (smtp2.osuosl.org [140.211.166.133]) by ash.osuosl.org (Postfix) with ESMTP id A52951C0ED1 for ; Wed, 23 Dec 2015 12:54:10 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by hemlock.osuosl.org (Postfix) with ESMTP id A128995937 for ; Wed, 23 Dec 2015 12:54:10 +0000 (UTC) X-Virus-Scanned: amavisd-new at osuosl.org Received: from hemlock.osuosl.org ([127.0.0.1]) by localhost (.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id TLav-ju+gYRO for ; Wed, 23 Dec 2015 12:54:06 +0000 (UTC) X-Greylist: domain auto-whitelisted by SQLgrey-1.7.6 Received: from mail2-relais-roc.national.inria.fr (mail2-relais-roc.national.inria.fr [192.134.164.83]) by hemlock.osuosl.org (Postfix) with ESMTPS id 9E69293C9E for ; Wed, 23 Dec 2015 12:54:05 +0000 (UTC) X-IronPort-AV: E=Sophos;i="5.20,468,1444687200"; d="scan'208";a="193753562" Received: from vaio-julia.rsr.lip6.fr ([132.227.76.33]) by mail2-relais-roc.national.inria.fr with ESMTP/TLS/DHE-RSA-AES256-SHA; 23 Dec 2015 13:54:02 +0100 Date: Wed, 23 Dec 2015 13:53:58 +0100 (CET) From: Julia Lawall X-X-Sender: jll@hadrien To: Gangfeng Huang Message-ID: User-Agent: Alpine 2.10 (DEB 1266 2009-07-14) MIME-Version: 1.0 Cc: intel-wired-lan@lists.osuosl.org, kbuild-all@01.org Subject: [Intel-wired-lan] [PATCH] igb: fix compare_const_fl.cocci warnings X-BeenThere: intel-wired-lan@lists.osuosl.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: Intel Wired Ethernet Linux Kernel Driver Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: intel-wired-lan-bounces@lists.osuosl.org Sender: "Intel-wired-lan" Kernel code typically uses == NULL. Generated by: scripts/coccinelle/misc/compare_const_fl.cocci CC: Gangfeng Huang Signed-off-by: Fengguang Wu Signed-off-by: Julia Lawall Tested-by: Aaron Brown --- Alternatively, consider using !adapter. igb_cdev.c | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) --- a/drivers/net/ethernet/intel/igb/igb_cdev.c +++ b/drivers/net/ethernet/intel/igb/igb_cdev.c @@ -92,7 +92,7 @@ static int igb_bind(struct file *file, v adapter = (struct igb_adapter *)file->private_data; - if (NULL == adapter) + if (adapter == NULL) return -ENOENT; mmap_size = pci_resource_len(adapter->pdev, 0); @@ -119,7 +119,7 @@ static long igb_mapring(struct file *fil return -EINVAL; adapter = file->private_data; - if (NULL == adapter) { + if (adapter == NULL) { dev_err(&adapter->pdev->dev, "map to unbound device!\n"); return -ENOENT; } @@ -182,7 +182,7 @@ static long igb_mapbuf(struct file *file return -EINVAL; adapter = file->private_data; - if (NULL == adapter) { + if (adapter == NULL) { dev_err(&adapter->pdev->dev, "map to unbound device!\n"); return -ENOENT; } @@ -246,7 +246,7 @@ static long igb_unmapring(struct file *f return -EINVAL; adapter = file->private_data; - if (NULL == adapter) { + if (adapter == NULL) { dev_err(&adapter->pdev->dev, "map to unbound device!\n"); return -ENOENT; } @@ -310,7 +310,7 @@ static long igb_unmapbuf(struct file *fi return -EFAULT; adapter = file->private_data; - if (NULL == adapter) { + if (adapter == NULL) { dev_err(&adapter->pdev->dev, "map to unbound device!\n"); return -ENOENT; } @@ -398,7 +398,7 @@ static int igb_close_file(struct inode * { struct igb_adapter *adapter = file->private_data; - if (NULL == adapter) + if (adapter == NULL) return 0; mutex_lock(&adapter->cdev_mutex); @@ -434,7 +434,7 @@ static int igb_mmap(struct file *file, s dma_addr_t pgoff = vma->vm_pgoff; dma_addr_t physaddr; - if (NULL == adapter) + if (adapter == NULL) return -ENODEV; if (pgoff == 0)