Skip to contentSkip to conversation

Staging: fwserial: Replace NULL comparison with !foo

PATCH In review Katie Dunne 2 participants 2 messages Mar 3, 2015 – Mar 4, 2015 Staging

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 Staging: fwserial: Replace NULL comparison with !foo

Addresses checkpatch.pl check
CHECK: Comparison to NULL could be written "!fifi->data"

Makes the indicated replacements

---
 drivers/staging/fwserial/dma_fifo.c | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)
drivers/staging/fwserial/dma_fifo.c +5 -5
index 0279062..4c50e08 100644
@@ -106,7 +106,7 @@ void dma_fifo_free(struct dma_fifo *fifo)
 {
 	struct dma_pending *pending, *next;
 
-	if (fifo->data == NULL)
+	if (!fifo->data)
 		return;
 
 	list_for_each_entry_safe(pending, next, &fifo->pending, link)
@@ -123,7 +123,7 @@ void dma_fifo_reset(struct dma_fifo *fifo)
 {
 	struct dma_pending *pending, *next;
 
-	if (fifo->data == NULL)
+	if (!fifo->data)
 		return;
 
 	list_for_each_entry_safe(pending, next, &fifo->pending, link)
@@ -149,7 +149,7 @@ int dma_fifo_in(struct dma_fifo *fifo, const void *src, int n)
 {
 	int ofs, l;
 
-	if (fifo->data == NULL)
+	if (!fifo->data)
 		return -ENOENT;
 	if (fifo->corrupt)
 		return -ENXIO;
@@ -192,7 +192,7 @@ int dma_fifo_out_pend(struct dma_fifo *fifo, struct dma_pending *pended)
 {
 	unsigned len, n, ofs, l, limit;
 
-	if (fifo->data == NULL)
+	if (!fifo->data)
 		return -ENOENT;
 	if (fifo->corrupt)
 		return -ENXIO;
@@ -252,7 +252,7 @@ int dma_fifo_out_complete(struct dma_fifo *fifo, struct dma_pending *complete)
 {
 	struct dma_pending *pending, *next, *tmp;
 
-	if (fifo->data == NULL)
+	if (!fifo->data)
 		return -ENOENT;
 	if (fifo->corrupt)
 		return -ENXIO;
Signature · 1 line
1.9.1
maintainer
#1 lore raw
Quoted 15 lines · Katie Dunne

Addresses checkpatch.pl check
CHECK: Comparison to NULL could be written "!fifi->data"

Makes the indicated replacements

---
 drivers/staging/fwserial/dma_fifo.c | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)
drivers/staging/fwserial/dma_fifo.c +0 -0
index 0279062..4c50e08 100644

drivers/staging/fwserial/dma_fifo.c void dma_fifo_free(struct dma_fifo *fifo) · line 109

Quoted 5 lines
drivers/staging/fwserial/dma_fifo.c +1 -1
@@ -106,7 +106,7 @@ void dma_fifo_free(struct dma_fifo *fifo)
 {
 	struct dma_pending *pending, *next;
 
-	if (fifo->data == NULL)
+	if (!fifo->data)

I really don't like this type of change, as you now loose the typesafe check for NULL and not 0, and it makes it a tiny bit harder to read.

So just please ignore that checkpatch warning, it's not that good.

thanks,

greg k-h