Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

net: ethernet: ti: davinci_cpdma: correct check on NULL in set rate

Check "ch" on NULL first, then get ctlr.

Signed-off-by: Ivan Khoronzhuk <ivan.khoronzhuk@linaro.org>
Signed-off-by: David S. Miller <davem@davemloft.net>

authored by

Ivan Khoronzhuk and committed by
David S. Miller
e33c2ef1 e3e37e70

+2 -1
+2 -1
drivers/net/ethernet/ti/davinci_cpdma.c
··· 835 835 */ 836 836 int cpdma_chan_set_rate(struct cpdma_chan *ch, u32 rate) 837 837 { 838 - struct cpdma_ctlr *ctlr = ch->ctlr; 839 838 unsigned long flags, ch_flags; 839 + struct cpdma_ctlr *ctlr; 840 840 int ret, prio_mode; 841 841 u32 rmask; 842 842 ··· 846 846 if (ch->rate == rate) 847 847 return rate; 848 848 849 + ctlr = ch->ctlr; 849 850 spin_lock_irqsave(&ctlr->lock, flags); 850 851 spin_lock_irqsave(&ch->lock, ch_flags); 851 852