summaryrefslogtreecommitdiffstats
path: root/drivers/scsi/mac53c94.c
diff options
context:
space:
mode:
authorJiapeng Chong <jiapeng.chong@linux.alibaba.com>2021-03-10 05:16:11 +0100
committerMartin K. Petersen <martin.petersen@oracle.com>2021-03-25 03:16:12 +0100
commitbe20b96b63197eb2e87ffa8973fadb194a16ee80 (patch)
tree75e6d3358ee08deeb2a0b480d62cc03836904c61 /drivers/scsi/mac53c94.c
parentscsi: dc395x: Use bitwise instead of arithmetic operator for flags (diff)
downloadlinux-be20b96b63197eb2e87ffa8973fadb194a16ee80.tar.xz
linux-be20b96b63197eb2e87ffa8973fadb194a16ee80.zip
scsi: mac53c94: Fix warning comparing pointer to 0
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. Link: https://lore.kernel.org/r/1615349771-81106-1-git-send-email-jiapeng.chong@linux.alibaba.com Reported-by: Abaci Robot <abaci@linux.alibaba.com> Signed-off-by: Jiapeng Chong <jiapeng.chong@linux.alibaba.com> Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
Diffstat (limited to 'drivers/scsi/mac53c94.c')
-rw-r--r--drivers/scsi/mac53c94.c13
1 files changed, 7 insertions, 6 deletions
diff --git a/drivers/scsi/mac53c94.c b/drivers/scsi/mac53c94.c
index 9e989776609b..ec9840d322e5 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));