struct fpga_reader *reader = filp->private_data;
        struct fpga_device *priv = reader->priv;
        struct list_head *used = &priv->used;
+       bool drop_buffer = false;
        struct data_buf *dbuf;
        size_t avail;
        void *data;
         * One of two things has happened, the device is disabled, or the
         * device has been reconfigured underneath us. In either case, we
         * should just throw away the buffer.
+        *
+        * Lockdep complains if this is done under the spinlock, so we
+        * handle it during the unlock path.
         */
        if (!priv->enabled || dbuf->size != priv->bufsize) {
-               videobuf_dma_unmap(priv->dev, &dbuf->vb);
-               data_free_buffer(dbuf);
+               drop_buffer = true;
                goto out_unlock;
        }
 
 
 out_unlock:
        spin_unlock_irq(&priv->lock);
+
+       if (drop_buffer) {
+               videobuf_dma_unmap(priv->dev, &dbuf->vb);
+               data_free_buffer(dbuf);
+       }
+
        return count;
 }