Commit f37c54b6 authored by Julia Lawall's avatar Julia Lawall Committed by David S. Miller

drivers/net/ethernet/ti/davinci_cpdma.c: Remove potential NULL dereference

If the NULL test is necessary, the initialization involving a dereference of
the tested value should be moved after the NULL test.

The sematic patch that fixes this problem is as follows:
(http://coccinelle.lip6.fr/)

// <smpl>
@@
type T;
expression E;
identifier i,fld;
statement S;
@@

- T i = E->fld;
+ T i;
  ... when != E
      when != i
  if (E == NULL) S
+ i = E->fld;
// </smpl>
Signed-off-by: default avatarJulia Lawall <Julia.Lawall@lip6.fr>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent aadf31de
...@@ -538,11 +538,12 @@ EXPORT_SYMBOL_GPL(cpdma_chan_create); ...@@ -538,11 +538,12 @@ EXPORT_SYMBOL_GPL(cpdma_chan_create);
int cpdma_chan_destroy(struct cpdma_chan *chan) int cpdma_chan_destroy(struct cpdma_chan *chan)
{ {
struct cpdma_ctlr *ctlr = chan->ctlr; struct cpdma_ctlr *ctlr;
unsigned long flags; unsigned long flags;
if (!chan) if (!chan)
return -EINVAL; return -EINVAL;
ctlr = chan->ctlr;
spin_lock_irqsave(&ctlr->lock, flags); spin_lock_irqsave(&ctlr->lock, flags);
if (chan->state != CPDMA_STATE_IDLE) if (chan->state != CPDMA_STATE_IDLE)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment