Skip to content

Commit e33c2ef

Browse files
ikhorndavem330
authored andcommitted
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 <[email protected]> Signed-off-by: David S. Miller <[email protected]>
1 parent e3e37e7 commit e33c2ef

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

drivers/net/ethernet/ti/davinci_cpdma.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -835,8 +835,8 @@ EXPORT_SYMBOL_GPL(cpdma_chan_get_min_rate);
835835
*/
836836
int cpdma_chan_set_rate(struct cpdma_chan *ch, u32 rate)
837837
{
838-
struct cpdma_ctlr *ctlr = ch->ctlr;
839838
unsigned long flags, ch_flags;
839+
struct cpdma_ctlr *ctlr;
840840
int ret, prio_mode;
841841
u32 rmask;
842842

@@ -846,6 +846,7 @@ int cpdma_chan_set_rate(struct cpdma_chan *ch, u32 rate)
846846
if (ch->rate == rate)
847847
return rate;
848848

849+
ctlr = ch->ctlr;
849850
spin_lock_irqsave(&ctlr->lock, flags);
850851
spin_lock_irqsave(&ch->lock, ch_flags);
851852

0 commit comments

Comments
 (0)