ARM: 7326/2: PL330: fix null pointer dereference in pl330_chan_ctrl()
[cascardo/linux.git] / arch / arm / common / pl330.c
index d8e44a4..ff3ad22 100644 (file)
@@ -1502,12 +1502,13 @@ int pl330_chan_ctrl(void *ch_id, enum pl330_chan_op op)
        struct pl330_thread *thrd = ch_id;
        struct pl330_dmac *pl330;
        unsigned long flags;
-       int ret = 0, active = thrd->req_running;
+       int ret = 0, active;
 
        if (!thrd || thrd->free || thrd->dmac->state == DYING)
                return -EINVAL;
 
        pl330 = thrd->dmac;
+       active = thrd->req_running;
 
        spin_lock_irqsave(&pl330->lock, flags);