瀏覽代碼

[media] v4l: omap_vout: Don't free buffers if they haven't been allocated

The VRFB buffers are freed when the device is closed even if they
haven't been allocated by a call to VIDIOC_REQBUFS, resulting in a
crash. Fix it by not trying to free buffers that are not allocated.

Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
Laurent Pinchart 9 年之前
父節點
當前提交
b446631c5a
共有 1 個文件被更改,包括 6 次插入4 次删除
  1. 6 4
      drivers/media/platform/omap/omap_vout_vrfb.c

+ 6 - 4
drivers/media/platform/omap/omap_vout_vrfb.c

@@ -79,10 +79,12 @@ void omap_vout_free_vrfb_buffers(struct omap_vout_device *vout)
 	int j;
 	int j;
 
 
 	for (j = 0; j < VRFB_NUM_BUFS; j++) {
 	for (j = 0; j < VRFB_NUM_BUFS; j++) {
-		omap_vout_free_buffer(vout->smsshado_virt_addr[j],
-				vout->smsshado_size);
-		vout->smsshado_virt_addr[j] = 0;
-		vout->smsshado_phy_addr[j] = 0;
+		if (vout->smsshado_virt_addr[j]) {
+			omap_vout_free_buffer(vout->smsshado_virt_addr[j],
+					      vout->smsshado_size);
+			vout->smsshado_virt_addr[j] = 0;
+			vout->smsshado_phy_addr[j] = 0;
+		}
 	}
 	}
 }
 }