* [PATCH] Staging: fwserial: Replace NULL comparison with !foo
@ 2015-03-03 18:13 Katie Dunne
2015-03-04 6:32 ` [Outreachy kernel] " Greg KH
0 siblings, 1 reply; 2+ messages in thread
From: Katie Dunne @ 2015-03-03 18:13 UTC (permalink / raw)
To: outreachy-kernel
Addresses checkpatch.pl check
CHECK: Comparison to NULL could be written "!fifi->data"
Makes the indicated replacements
Signed-off-by: Katie Dunne <kdunne@mail.ccsf.edu>
---
drivers/staging/fwserial/dma_fifo.c | 10 +++++-----
1 file changed, 5 insertions(+), 5 deletions(-)
diff --git a/drivers/staging/fwserial/dma_fifo.c b/drivers/staging/fwserial/dma_fifo.c
index 0279062..4c50e08 100644
--- a/drivers/staging/fwserial/dma_fifo.c
+++ b/drivers/staging/fwserial/dma_fifo.c
@@ -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;
--
1.9.1
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [Outreachy kernel] [PATCH] Staging: fwserial: Replace NULL comparison with !foo
2015-03-03 18:13 [PATCH] Staging: fwserial: Replace NULL comparison with !foo Katie Dunne
@ 2015-03-04 6:32 ` Greg KH
0 siblings, 0 replies; 2+ messages in thread
From: Greg KH @ 2015-03-04 6:32 UTC (permalink / raw)
To: Katie Dunne; +Cc: outreachy-kernel
On Tue, Mar 03, 2015 at 10:13:51AM -0800, Katie Dunne wrote:
> Addresses checkpatch.pl check
> CHECK: Comparison to NULL could be written "!fifi->data"
>
> Makes the indicated replacements
>
> Signed-off-by: Katie Dunne <kdunne@mail.ccsf.edu>
> ---
> drivers/staging/fwserial/dma_fifo.c | 10 +++++-----
> 1 file changed, 5 insertions(+), 5 deletions(-)
>
> diff --git a/drivers/staging/fwserial/dma_fifo.c b/drivers/staging/fwserial/dma_fifo.c
> index 0279062..4c50e08 100644
> --- a/drivers/staging/fwserial/dma_fifo.c
> +++ b/drivers/staging/fwserial/dma_fifo.c
> @@ -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
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2015-03-04 6:33 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-03-03 18:13 [PATCH] Staging: fwserial: Replace NULL comparison with !foo Katie Dunne
2015-03-04 6:32 ` [Outreachy kernel] " Greg KH
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.