linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] scsi: aha1740: Use !x in place of NULL comparisons
@ 2019-07-11 23:48 Keyur Patel
  2019-07-11 23:52 ` James Bottomley
  0 siblings, 1 reply; 3+ messages in thread
From: Keyur Patel @ 2019-07-11 23:48 UTC (permalink / raw)
  Cc: iamkeyur96, James E.J. Bottomley, Martin K. Petersen, linux-scsi,
	linux-kernel

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

Signed-off-by: Keyur Patel <iamkeyur96@gmail.com>
---
 drivers/scsi/aha1740.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/scsi/aha1740.c b/drivers/scsi/aha1740.c
index da4150c17781..ec81b7be0a60 100644
--- a/drivers/scsi/aha1740.c
+++ b/drivers/scsi/aha1740.c
@@ -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;
-- 
2.22.0


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH] scsi: aha1740: Use !x in place of NULL comparisons
  2019-07-11 23:48 [PATCH] scsi: aha1740: Use !x in place of NULL comparisons Keyur Patel
@ 2019-07-11 23:52 ` James Bottomley
  2019-07-12  0:38   ` Martin K. Petersen
  0 siblings, 1 reply; 3+ messages in thread
From: James Bottomley @ 2019-07-11 23:52 UTC (permalink / raw)
  To: Keyur Patel; +Cc: Martin K. Petersen, linux-scsi, linux-kernel

On Thu, 2019-07-11 at 19:48 -0400, Keyur Patel wrote:
> 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


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] scsi: aha1740: Use !x in place of NULL comparisons
  2019-07-11 23:52 ` James Bottomley
@ 2019-07-12  0:38   ` Martin K. Petersen
  0 siblings, 0 replies; 3+ messages in thread
From: Martin K. Petersen @ 2019-07-12  0:38 UTC (permalink / raw)
  To: James Bottomley; +Cc: Keyur Patel, Martin K. Petersen, linux-scsi, linux-kernel


James,

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

I agree.

-- 
Martin K. Petersen	Oracle Linux Engineering

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2019-07-12  0:38 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-07-11 23:48 [PATCH] scsi: aha1740: Use !x in place of NULL comparisons Keyur Patel
2019-07-11 23:52 ` James Bottomley
2019-07-12  0:38   ` Martin K. Petersen

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).