Received: by 2002:ac0:a5b6:0:0:0:0:0 with SMTP id m51-v6csp2556977imm; Sun, 3 Jun 2018 06:23:52 -0700 (PDT) X-Google-Smtp-Source: ADUXVKIcrLQua1YgJgunhc06f/b9lCxtwPOw8hkDqpXGXEfdiWsOpO+GwBBikyhxqS0/tDyuANfP X-Received: by 2002:a17:902:a717:: with SMTP id w23-v6mr14617514plq.130.1528032232670; Sun, 03 Jun 2018 06:23:52 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1528032232; cv=none; d=google.com; s=arc-20160816; b=qPRXFPOxxtTpNglMowij5210Mk8AGXqhnPN1N2LQK6e7FkFmw9I0oSRrwT/BCc2qMV 3hdqZo6ozGe5y077Vv/HgQWfd+3OlKz5Im4CArrw0z02j29Dl+8NpMop2KklJ4WCS34s 90WaOG0sEfRsCU3Sk7pD79+R+pE9DHjcoGUGjkHiuP148Mb7xa9LECdvTqmUtbIdkXgH vZyPYdH80Dd5q/NMR3Q+lfe16oDCpkpXcPoOD46KP4AV2BdlB61TZhbG/npaHnyh1Ko0 btNLJ6CyjSu8EMCFnKBF9FAWEHM+5QueL5KD0CjGr/2V+XkbfKIal5JSwMxTuYyrNIf4 TevQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:message-id:date :subject:cc:to:from:dkim-signature:arc-authentication-results; bh=58NOT1zwAwusTm9SeAfz+VH3qU4yjPulZ35pAOqH7B4=; b=B71T47xtGWLPqsueNuhJNSyPxw03P7qj0ZNpCMDscPV5NL1LLIXzZ3tWEzGZ2TmvYQ uWDoi2JjQHh6AEOf4AiGnEIVHvuAPZ6cFjh9ADnYVNPA7PkqxcutTIrEnFG9z11OekVK lbZjsT46kWqjtXhGZBfAy/fRbA4YMEAcoohCRIUiDXb+WowG/9oro+n2prJCO60HUcWT lv0c+u8gsgaSARukK3TPgdnb5MZjrJKjkfNkXeGTuMP28tF1EQlNkQiwKhx0CIEd74lU SusNMRNsaBRUOycA4qc79xO+MIlY92zkxMgkzOiLmQBUcQS6n7ImUCSflX8e6Upnv5KT Op+w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=qIS05XmC; 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; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id n68-v6si4097054pfb.152.2018.06.03.06.23.38; Sun, 03 Jun 2018 06:23:52 -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; dkim=pass header.i=@gmail.com header.s=20161025 header.b=qIS05XmC; 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; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751478AbeFCNWV (ORCPT + 99 others); Sun, 3 Jun 2018 09:22:21 -0400 Received: from mail-pf0-f195.google.com ([209.85.192.195]:39449 "EHLO mail-pf0-f195.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751057AbeFCNWT (ORCPT ); Sun, 3 Jun 2018 09:22:19 -0400 Received: by mail-pf0-f195.google.com with SMTP id r11-v6so7064403pfl.6; Sun, 03 Jun 2018 06:22:19 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=58NOT1zwAwusTm9SeAfz+VH3qU4yjPulZ35pAOqH7B4=; b=qIS05XmCr/DEFq09lDdJIA95W9YhWTeLOuKqs4gfRQkqm0qyoScgtEkaCycKXicsgq yO1Pc7zuyRW1KlWgLTMzgRJWaz9lGKLEUKn4UWLZ34gX4OxzGyeqSEerhlcffPvZXWHc KO3RrtaWtUrTvvqc2ihwRcUrrFw/e9ltASP7ufR6f2CE95HXmYZY42m3VfGKO4ayI0UQ eaM/5u47txdvDPCvEP3WIOKp2N1fDTfOqJJlKCr6rLrTlbWuKEIF/KDd+QHvKQk5sI8U 5ISja3XDcn/37Sybqycp1h4XLZpaAcF1PK58+bxo6PuW306Iz73hDdieT7PA/EJCNz5h 0Jvg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=58NOT1zwAwusTm9SeAfz+VH3qU4yjPulZ35pAOqH7B4=; b=Q0xERF633MMWm6QR5vQUjUxaxg3unsmq3xNR5DwilMZtk1e1VnZdRGYm4jclyuOgd+ 39gjEm5/0Z0Q9FAGrjvTnIUd+YnLCqtgqHz74TTKDrhNDxrlina0jOJK21O6APtU3iaN 0Wg4hpYj/QseyxzvkaEpERyHfH19Nmp1xaGspVVhgRNtEoetN7hP5Gb+3d+3MwC6ULdA peGMeLVDreUF58sQB5cjLhI4WdqUWwFjfwQFd6xOavwJyIrAQgnZ8mlFWe37emHC4gMU cPheU9rPXey0kxwSqvu37sFYCoGcMYBOdwqeCofxwFFSjjUMPfx4de/v1fKOi633J5Yg p0Cw== X-Gm-Message-State: ALKqPwe72JgMrcP5iGrLYZanziqNRNbIfxpJuPHruPdOHjldk2D94C1a CdzhRYyvq/FHRF3J2xtVmyQ= X-Received: by 2002:a63:9611:: with SMTP id c17-v6mr11049721pge.361.1528032139087; Sun, 03 Jun 2018 06:22:19 -0700 (PDT) Received: from localhost.localdomain ([117.192.158.77]) by smtp.googlemail.com with ESMTPSA id z19-v6sm16718505pgv.12.2018.06.03.06.22.15 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Sun, 03 Jun 2018 06:22:18 -0700 (PDT) From: Varsha Rao To: Sathya Prakash , Chaitra P B , Suganath Prabu Subramani , MPT-FusionLinux.pdl@broadcom.com, linux-scsi@vger.kernel.org, linux-kernel@vger.kernel.org, Nicholas Mc Guire , Lukas Bulwahn Cc: Varsha Rao Subject: [PATCH 2/3] message: fusion: Replace NULL comparison Date: Sun, 3 Jun 2018 18:52:04 +0530 Message-Id: X-Mailer: git-send-email 2.17.0 In-Reply-To: References: Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Replace x == NULL with !x, to fix checkpatch issue. Following coccinelle script is used to fix it. @disable is_null@ expression e; @@ - e == NULL +!e Signed-off-by: Varsha Rao --- drivers/message/fusion/mptbase.c | 45 ++++++++++++++++---------------- 1 file changed, 22 insertions(+), 23 deletions(-) diff --git a/drivers/message/fusion/mptbase.c b/drivers/message/fusion/mptbase.c index 3fe53b65c5fa..2e5e5487f193 100644 --- a/drivers/message/fusion/mptbase.c +++ b/drivers/message/fusion/mptbase.c @@ -488,7 +488,7 @@ mpt_turbo_reply(MPT_ADAPTER *ioc, u32 pa) /* Check for (valid) IO callback! */ if (!cb_idx || cb_idx >= MPT_MAX_PROTOCOL_DRIVERS || - MptCallbacks[cb_idx] == NULL) { + !MptCallbacks[cb_idx]) { printk(MYIOC_s_WARN_FMT "%s: Invalid cb_idx (%d)!\n", __func__, ioc->name, cb_idx); goto out; @@ -552,7 +552,7 @@ mpt_reply(MPT_ADAPTER *ioc, u32 pa) /* Check for (valid) IO callback! */ if (!cb_idx || cb_idx >= MPT_MAX_PROTOCOL_DRIVERS || - MptCallbacks[cb_idx] == NULL) { + !MptCallbacks[cb_idx]) { printk(MYIOC_s_WARN_FMT "%s: Invalid cb_idx (%d)!\n", __func__, ioc->name, cb_idx); freeme = 0; @@ -707,7 +707,7 @@ mpt_register(MPT_CALLBACK cbfunc, MPT_DRIVER_CLASS dclass, char *func_name) * (slot/handle 0 is reserved!) */ for (cb_idx = MPT_MAX_PROTOCOL_DRIVERS-1; cb_idx; cb_idx--) { - if (MptCallbacks[cb_idx] == NULL) { + if (!MptCallbacks[cb_idx]) { MptCallbacks[cb_idx] = cbfunc; MptDriverClass[cb_idx] = dclass; MptEvHandlers[cb_idx] = NULL; @@ -928,7 +928,7 @@ mpt_get_msg_frame(u8 cb_idx, MPT_ADAPTER *ioc) spin_unlock_irqrestore(&ioc->FreeQlock, flags); #ifdef MFCNT - if (mf == NULL) + if (!mf) printk(MYIOC_s_WARN_FMT "IOC Active. No free Msg Frames! " "Count 0x%x Max 0x%x\n", ioc->name, ioc->mfcnt, ioc->req_depth); @@ -1723,7 +1723,7 @@ mpt_mapresources(MPT_ADAPTER *ioc) /* Get logical ptr for PciMem0 space */ /*mem = ioremap(mem_phys, msize);*/ mem = ioremap(mem_phys, msize); - if (mem == NULL) { + if (!mem) { printk(MYIOC_s_ERR_FMT ": ERROR - Unable to map adapter" " memory!\n", ioc->name); r = -EINVAL; @@ -1780,7 +1780,7 @@ mpt_attach(struct pci_dev *pdev, const struct pci_device_id *id) #endif ioc = kzalloc(sizeof(MPT_ADAPTER), GFP_ATOMIC); - if (ioc == NULL) { + if (!ioc) { printk(KERN_ERR MYNAM ": ERROR - Insufficient memory to add adapter!\n"); return -ENOMEM; } @@ -2819,7 +2819,7 @@ mpt_adapter_dispose(MPT_ADAPTER *ioc) { int sz_first, sz_last; - if (ioc == NULL) + if (!ioc) return; sz_first = ioc->alloc_total; @@ -4326,17 +4326,17 @@ initChainBuffers(MPT_ADAPTER *ioc) /* ReqToChain size must equal the req_depth * index = req_idx */ - if (ioc->ReqToChain == NULL) { + if (!ioc->ReqToChain) { sz = ioc->req_depth * sizeof(int); mem = kmalloc(sz, GFP_ATOMIC); - if (mem == NULL) + if (!mem) return -1; ioc->ReqToChain = (int *) mem; dinitprintk(ioc, printk(MYIOC_s_DEBUG_FMT "ReqToChain alloc @ %p, sz=%d bytes\n", ioc->name, mem, sz)); mem = kmalloc(sz, GFP_ATOMIC); - if (mem == NULL) + if (!mem) return -1; ioc->RequestNB = (int *) mem; @@ -4401,9 +4401,9 @@ initChainBuffers(MPT_ADAPTER *ioc) ioc->num_chain = num_chain; sz = num_chain * sizeof(int); - if (ioc->ChainToChain == NULL) { + if (!ioc->ChainToChain) { mem = kmalloc(sz, GFP_ATOMIC); - if (mem == NULL) + if (!mem) return -1; ioc->ChainToChain = (int *) mem; @@ -4441,7 +4441,7 @@ PrimeIocFifos(MPT_ADAPTER *ioc) /* Prime reply FIFO... */ - if (ioc->reply_frames == NULL) { + if (!ioc->reply_frames) { if ( (num_chain = initChainBuffers(ioc)) < 0) return -1; /* @@ -4493,7 +4493,7 @@ PrimeIocFifos(MPT_ADAPTER *ioc) total_size += sz; mem = pci_alloc_consistent(ioc->pcidev, total_size, &alloc_dma); - if (mem == NULL) { + if (!mem) { printk(MYIOC_s_ERR_FMT "Unable to allocate Reply, Request, Chain Buffers!\n", ioc->name); goto out_fail; @@ -4571,7 +4571,7 @@ PrimeIocFifos(MPT_ADAPTER *ioc) sz = (ioc->req_depth * MPT_SENSE_BUFFER_ALLOC); ioc->sense_buf_pool = pci_alloc_consistent(ioc->pcidev, sz, &ioc->sense_buf_pool_dma); - if (ioc->sense_buf_pool == NULL) { + if (!ioc->sense_buf_pool) { printk(MYIOC_s_ERR_FMT "Unable to allocate Sense Buffers!\n", ioc->name); goto out_fail; @@ -5090,7 +5090,7 @@ mptbase_sas_persist_operation(MPT_ADAPTER *ioc, u8 persist_opcode) /* Get a MF for this command. */ - if ((mf = mpt_get_msg_frame(mpt_base_index, ioc)) == NULL) { + if (!(mf = mpt_get_msg_frame(mpt_base_index, ioc))) { printk(KERN_DEBUG "%s: no msg frames!\n", __func__); ret = -1; goto out; @@ -5370,7 +5370,7 @@ mpt_GetScsiPortSettings(MPT_ADAPTER *ioc, int portnum) u8 *mem; sz = MPT_MAX_SCSI_DEVICES * sizeof(int); mem = kmalloc(sz, GFP_ATOMIC); - if (mem == NULL) + if (!mem) return -EFAULT; ioc->spi_data.nvram = (int *) mem; @@ -5690,8 +5690,7 @@ mpt_inactive_raid_volumes(MPT_ADAPTER *ioc, u8 channel, u8 id) buffer->PhysDisk[i].PhysDiskNum, &phys_disk) != 0) continue; - if ((component_info = kmalloc(sizeof (*component_info), - GFP_KERNEL)) == NULL) + if (!(component_info = kmalloc(sizeof(*component_info), GFP_KERNEL))) continue; component_info->volumeID = id; @@ -6104,7 +6103,7 @@ mpt_read_ioc_pg_4(MPT_ADAPTER *ioc) if (header.PageLength == 0) return; - if ( (pIoc4 = ioc->spi_data.pIocPg4) == NULL ) { + if (!(pIoc4 = ioc->spi_data.pIocPg4)) { iocpage4sz = (header.PageLength + 4) * 4; /* Allow 4 additional SEP's */ pIoc4 = pci_alloc_consistent(ioc->pcidev, iocpage4sz, &ioc4_dma); if (!pIoc4) @@ -6300,7 +6299,7 @@ SendEventAck(MPT_ADAPTER *ioc, EventNotificationReply_t *evnp) { EventAck_t *pAck; - if ((pAck = (EventAck_t *) mpt_get_msg_frame(mpt_base_index, ioc)) == NULL) { + if (!(pAck = (EventAck_t *)mpt_get_msg_frame(mpt_base_index, ioc))) { dfailprintk(ioc, printk(MYIOC_s_WARN_FMT "%s, no msg frames!!\n", ioc->name, __func__)); return -1; @@ -6391,7 +6390,7 @@ mpt_config(MPT_ADAPTER *ioc, CONFIGPARMS *pCfg) /* Get and Populate a free Frame */ - if ((mf = mpt_get_msg_frame(mpt_base_index, ioc)) == NULL) { + if (!(mf = mpt_get_msg_frame(mpt_base_index, ioc))) { dcprintk(ioc, printk(MYIOC_s_WARN_FMT "mpt_config: no msg frames!\n", ioc->name)); ret = -EAGAIN; @@ -6603,7 +6602,7 @@ static int procmpt_create(void) { mpt_proc_root_dir = proc_mkdir(MPT_PROCFS_MPTBASEDIR, NULL); - if (mpt_proc_root_dir == NULL) + if (!mpt_proc_root_dir) return -ENOTDIR; proc_create("summary", S_IRUGO, mpt_proc_root_dir, &mpt_summary_proc_fops); -- 2.17.0