Received: by 2002:a05:6a10:8c0a:0:0:0:0 with SMTP id go10csp178860pxb; Tue, 9 Mar 2021 20:18:10 -0800 (PST) X-Google-Smtp-Source: ABdhPJz2UY3p//qZvTi+eUhPbgmkbP1oyNUyXVoYtyWdSc0H7x84qt1zF13pdST2Ymdx0ZnvxYl9 X-Received: by 2002:a17:906:ad96:: with SMTP id la22mr1499228ejb.237.1615349889815; Tue, 09 Mar 2021 20:18:09 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1615349889; cv=none; d=google.com; s=arc-20160816; b=pHPHf0dQLE6k2yQK58hhuS0KNW2UXe33sdnHOT13xvyaFCNVxPSD8KMnMa91Fb+6Jw 65PKVTNbRxc40/r0ViTss8cHrg7gtsreC1GGkTXw3D10H69SxI5WtTQvYPPq7pPVLIq3 8eGxfvFgamftDlbfbo4V/u16v1bosqkecgUbwl9tPhPYL8YlNVzF3mfisYkJnFO4MHDB 1obNF31+E7m/H0SZvcPQ8ydD7yYv4bnUEzm985UOVOS1UKdFeqkBvYfsEhwVi/OjSNZ3 Tt31sePhz+/bLMTHbsM78hsFxEDO5SWNJcjkzi8J1IV9CjIoA7Orj2NCAG0utHmMVAim YLvA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:message-id:date:subject:cc:to:from; bh=QdmgKmVCnUtNussO7t2bbC3ZAT3lOa1aHizJj6oTqbA=; b=Af7NSt3lkgeb6eW9WqGBqCOy9blaLH+0bei7wzwOyXhrvc6tT9SHFqdKCQcIunyJ4Q JCq38gZ62J9iSGFwa54xyTkE9euV0yQtoAbEPZWOwE3NyXTfw6uPWoEGevAxQHHiq4ej 87C5mo7B0344WD2CY4cL3Gt7ytG2aEcLBx0j5KDQNNLjkvdz7QQk8uFsikOPdKJXZeg9 9mUl5kq+ayLi58m5fP95vmkLJZHn0US3nlOt1Ni9t/fz7gMK7FLPuA9yIMfIjT1jhaFE tO6WYklrshtdrjxy1m7z4hQ1R0JqrZTk+a7McsKGLYc20WEk5FTdBQGD52Dw+US/Y2v0 aurA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=alibaba.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id a17si10760232edu.207.2021.03.09.20.17.46; Tue, 09 Mar 2021 20:18:09 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=alibaba.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230490AbhCJEQt (ORCPT + 99 others); Tue, 9 Mar 2021 23:16:49 -0500 Received: from out30-132.freemail.mail.aliyun.com ([115.124.30.132]:49197 "EHLO out30-132.freemail.mail.aliyun.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229485AbhCJEQU (ORCPT ); Tue, 9 Mar 2021 23:16:20 -0500 X-Alimail-AntiSpam: AC=PASS;BC=-1|-1;BR=01201311R171e4;CH=green;DM=||false|;DS=||;FP=0|-1|-1|-1|0|-1|-1|-1;HT=e01e04394;MF=jiapeng.chong@linux.alibaba.com;NM=1;PH=DS;RN=5;SR=0;TI=SMTPD_---0URBRf4e_1615349772; Received: from j63c13417.sqa.eu95.tbsite.net(mailfrom:jiapeng.chong@linux.alibaba.com fp:SMTPD_---0URBRf4e_1615349772) by smtp.aliyun-inc.com(127.0.0.1); Wed, 10 Mar 2021 12:16:18 +0800 From: Jiapeng Chong To: jejb@linux.ibm.com Cc: martin.petersen@oracle.com, linux-scsi@vger.kernel.org, linux-kernel@vger.kernel.org, Jiapeng Chong Subject: [PATCH] scsi: mac53c94: fix warning comparing pointer to 0 Date: Wed, 10 Mar 2021 12:16:11 +0800 Message-Id: <1615349771-81106-1-git-send-email-jiapeng.chong@linux.alibaba.com> X-Mailer: git-send-email 1.8.3.1 Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Fix the following coccicheck warning: ./drivers/scsi/mac53c94.c:470:29-30: WARNING comparing pointer to 0. ./drivers/scsi/mac53c94.c:349:12-13: WARNING comparing pointer to 0. Reported-by: Abaci Robot Signed-off-by: Jiapeng Chong --- drivers/scsi/mac53c94.c | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/drivers/scsi/mac53c94.c b/drivers/scsi/mac53c94.c index 9e98977..ec9840d 100644 --- a/drivers/scsi/mac53c94.c +++ b/drivers/scsi/mac53c94.c @@ -346,7 +346,7 @@ static void cmd_done(struct fsc_state *state, int result) struct scsi_cmnd *cmd; cmd = state->current_req; - if (cmd != 0) { + if (cmd) { cmd->result = result; (*cmd->scsi_done)(cmd); state->current_req = NULL; @@ -467,12 +467,13 @@ static int mac53c94_probe(struct macio_dev *mdev, const struct of_device_id *mat dma_cmd_space = kmalloc_array(host->sg_tablesize + 2, sizeof(struct dbdma_cmd), GFP_KERNEL); - if (dma_cmd_space == 0) { - printk(KERN_ERR "mac53c94: couldn't allocate dma " - "command space for %pOF\n", node); + if (!dma_cmd_space) { + printk(KERN_ERR "mac53c94: couldn't allocate dma " + "command space for %pOF\n", node); rc = -ENOMEM; - goto out_free; - } + goto out_free; + } + state->dma_cmds = (struct dbdma_cmd *)DBDMA_ALIGN(dma_cmd_space); memset(state->dma_cmds, 0, (host->sg_tablesize + 1) * sizeof(struct dbdma_cmd)); -- 1.8.3.1