Skip to contentSkip to conversation

media: v4l: omap_vout: vrfb: initialize DMA flags

PATCH In review Arnd Bergmann 2 participants 2 messages Jul 10, 2017 – Jul 17, 2017 Media (V4L/DVB)

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 media: v4l: omap_vout: vrfb: initialize DMA flags

Passing uninitialized flags into device_prep_interleaved_dma is clearly a bad idea, and we get a compiler warning for it:

drivers/media/platform/omap/omap_vout_vrfb.c: In function 'omap_vout_prepare_vrfb':
drivers/media/platform/omap/omap_vout_vrfb.c:273:5: error: 'flags' may be used uninitialized in this function [-Werror=maybe-uninitialized]

It seems that the OMAP dmaengine ignores the flags, but we should pick the right ones anyway. Unfortunately I don't know what they should be, so I just picked the most common flags. Please set the right flags here and fold the modified patch.

Fixes 6a1560ecaa8c ("media: v4l: omap_vout: vrfb: Convert to dmaengine")
---
 drivers/media/platform/omap/omap_vout_vrfb.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/media/platform/omap/omap_vout_vrfb.c +1 -1
index 45a553d4f5b2..fed28b6bbbc0 100644
@@ -233,7 +233,7 @@ int omap_vout_prepare_vrfb(struct omap_vout_device *vout,
 			   struct videobuf_buffer *vb)
 {
 	struct dma_async_tx_descriptor *tx;
-	enum dma_ctrl_flags flags;
+	enum dma_ctrl_flags flags = DMA_PREP_INTERRUPT | DMA_CTRL_ACK;
 	struct dma_chan *chan = vout->vrfb_dma_tx.chan;
 	struct dma_device *dmadev = chan->device;
 	struct dma_interleaved_template *xt = vout->vrfb_dma_tx.xt;
Signature · 1 line
2.9.0
Acked-by on v1 1/1
#1 lore raw

Arnd,

sorry for the delayed response, I was away w/o internet connection for the past weeks.

Quoted 5 lines · Arnd Bergmann

Passing uninitialized flags into device_prep_interleaved_dma is clearly a bad idea, and we get a compiler warning for it:

drivers/media/platform/omap/omap_vout_vrfb.c: In function 'omap_vout_prepare_vrfb':
drivers/media/platform/omap/omap_vout_vrfb.c:273:5: error: 'flags' may be used uninitialized in this function [-Werror=maybe-uninitialized]

I can not explain why I have missed this.

Quoted 4 lines

It seems that the OMAP dmaengine ignores the flags, but we should pick the right ones anyway. Unfortunately I don't know what they should be, so I just picked the most common flags. Please set the right flags here and fold the modified patch.

The flags are fine.

Quoted 3 lines
Fixes 6a1560ecaa8c ("media: v4l: omap_vout: vrfb: Convert to dmaengine")
Quoted 10 lines
---
 drivers/media/platform/omap/omap_vout_vrfb.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/media/platform/omap/omap_vout_vrfb.c +0 -0
index 45a553d4f5b2..fed28b6bbbc0 100644

drivers/media/platform/omap/omap_vout_vrfb.c int omap_vout_prepare_vrfb(struct omap_vout_device *vout, · line 239

Quoted 8 lines
drivers/media/platform/omap/omap_vout_vrfb.c +1 -1
@@ -233,7 +233,7 @@ int omap_vout_prepare_vrfb(struct omap_vout_device *vout,
 			   struct videobuf_buffer *vb)
 {
 	struct dma_async_tx_descriptor *tx;
-	enum dma_ctrl_flags flags;
+	enum dma_ctrl_flags flags = DMA_PREP_INTERRUPT | DMA_CTRL_ACK;
 	struct dma_chan *chan = vout->vrfb_dma_tx.chan;
 	struct dma_device *dmadev = chan->device;
 	struct dma_interleaved_template *xt = vout->vrfb_dma_tx.xt;

- Péter