Skip to contentSkip to conversation

net: ethernet: ti: davinci_cpdma: add set rate for a channel

bug report Dan Carpenter 1 participant 1 message Jan 16, 2017 Kernel janitors

lore
Share & tools
lore
#0 lore raw

Hello Ivan Khoronzhuk,

This is a semi-automatic email about new static checker warnings.

The patch 8f32b90981dc: "net: ethernet: ti: davinci_cpdma: add set rate for a channel" from Nov 29, 2016, leads to the following Smatch complaint:

drivers/net/ethernet/ti/davinci_cpdma.c:843 cpdma_chan_set_rate()
warn: variable dereferenced before check 'ch' (see line 838)

drivers/net/ethernet/ti/davinci_cpdma.c
837 {

   838		struct cpdma_ctlr *ctlr = ch->ctlr;
                                          ^^^^

New NULL check?

839 unsigned long flags, ch_flags;
840 int ret, prio_mode;
841 u32 rmask;
842
843 if (!ch || !is_tx_chan(ch))

                    ^^^

Too late.

844 return -EINVAL;
845

regards,
dan carpenter