Skip to contentSkip to conversation

scsi: aha1740: Use !x in place of NULL comparisons

PATCH In review Keyur Patel 3 participants 3 messages Jul 11, 2019 – Jul 12, 2019 SCSI

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 scsi: aha1740: Use !x in place of NULL comparisons

Change (x == NULL) to !x and (x != NULL) to x, to fix following checkpatch.pl warnings:
CHECK: Comparison to NULL could be written "!x".

---
 drivers/scsi/aha1740.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/scsi/aha1740.c +2 -2
index da4150c17781..ec81b7be0a60 100644
@@ -385,7 +385,7 @@ static int aha1740_queuecommand_lck(struct scsi_cmnd * SCpnt,
 	SCpnt->host_scribble = dma_alloc_coherent (&host->edev->dev,
 						   sizeof (struct aha1740_sg),
 						   &sg_dma, GFP_ATOMIC);
-	if(SCpnt->host_scribble == NULL) {
+	if (!(SCpnt->host_scribble)) {
 		printk(KERN_WARNING "aha1740: out of memory in queuecommand!\n");
 		return 1;
 	}
@@ -576,7 +576,7 @@ static int aha1740_probe (struct device *dev)
 	       translation ? "en" : "dis");
 	shpnt = scsi_host_alloc(&aha1740_template,
 			      sizeof(struct aha1740_hostdata));
-	if(shpnt == NULL)
+	if (!shpnt)
 		goto err_release_region;
 
 	shpnt->base = 0;
Signature · 1 line
2.22.0
#1 lore raw
Quoted 3 lines · Keyur Patel

Change (x == NULL) to !x and (x != NULL) to x, to fix following checkpatch.pl warnings:
CHECK: Comparison to NULL could be written "!x".

This is one of our significantly older drivers. We try not to touch it unless we really have to, so I'd rather not have patches like this applied to it.

I also don't really think the replacement adds anything to readability, so it should probably be removed from the checkpatch warnings.

Thanks,

James

#2 lore raw

James,

Quoted 2 lines

I also don't really think the replacement adds anything to readability, so it should probably be removed from the checkpatch warnings.

I agree.

Signature · 1 line
Martin K. Petersen	Oracle Linux Engineering