summaryrefslogtreecommitdiffstats
path: root/drivers
diff options
context:
space:
mode:
authorIvan Khoronzhuk <ivan.khoronzhuk@linaro.org>2017-01-18 02:28:06 +0200
committerDavid S. Miller <davem@davemloft.net>2017-01-18 16:46:01 -0500
commite33c2ef106d17ad8cdb16a0be0ef0daebb2d2c16 (patch)
tree192550e8c29061b72074fe11463d8296369e2e74 /drivers
parente3e37e701713731b22f8cebfa1f5deed455cad8a (diff)
downloadlinux-e33c2ef106d17ad8cdb16a0be0ef0daebb2d2c16.tar.bz2
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>
Diffstat (limited to 'drivers')
-rw-r--r--drivers/net/ethernet/ti/davinci_cpdma.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/drivers/net/ethernet/ti/davinci_cpdma.c b/drivers/net/ethernet/ti/davinci_cpdma.c
index d80bff19d4ec..7ecc6b70e7e8 100644
--- a/drivers/net/ethernet/ti/davinci_cpdma.c
+++ b/drivers/net/ethernet/ti/davinci_cpdma.c
@@ -835,8 +835,8 @@ EXPORT_SYMBOL_GPL(cpdma_chan_get_min_rate);
*/
int cpdma_chan_set_rate(struct cpdma_chan *ch, u32 rate)
{
- struct cpdma_ctlr *ctlr = ch->ctlr;
unsigned long flags, ch_flags;
+ struct cpdma_ctlr *ctlr;
int ret, prio_mode;
u32 rmask;
@@ -846,6 +846,7 @@ int cpdma_chan_set_rate(struct cpdma_chan *ch, u32 rate)
if (ch->rate == rate)
return rate;
+ ctlr = ch->ctlr;
spin_lock_irqsave(&ctlr->lock, flags);
spin_lock_irqsave(&ch->lock, ch_flags);