diff options
author | Laurent Pinchart <laurent.pinchart@ideasonboard.com> | 2015-11-10 05:20:19 -0500 |
---|---|---|
committer | Mauro Carvalho Chehab <mchehab@osg.samsung.com> | 2015-11-19 08:15:20 -0500 |
commit | b446631c5acfec93df643bdf2d142020ae328ced (patch) | |
tree | 93fa71aec7f36afe3106a3ca4a9649112efb01e8 | |
parent | cd1e11bed2093af31b114b4c3cda444e89c3c3b5 (diff) |
[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>
-rw-r--r-- | drivers/media/platform/omap/omap_vout_vrfb.c | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/drivers/media/platform/omap/omap_vout_vrfb.c b/drivers/media/platform/omap/omap_vout_vrfb.c index c6e252760c62..b8638e4e1627 100644 --- a/drivers/media/platform/omap/omap_vout_vrfb.c +++ b/drivers/media/platform/omap/omap_vout_vrfb.c | |||
@@ -79,10 +79,12 @@ void omap_vout_free_vrfb_buffers(struct omap_vout_device *vout) | |||
79 | int j; | 79 | int j; |
80 | 80 | ||
81 | for (j = 0; j < VRFB_NUM_BUFS; j++) { | 81 | for (j = 0; j < VRFB_NUM_BUFS; j++) { |
82 | omap_vout_free_buffer(vout->smsshado_virt_addr[j], | 82 | if (vout->smsshado_virt_addr[j]) { |
83 | vout->smsshado_size); | 83 | omap_vout_free_buffer(vout->smsshado_virt_addr[j], |
84 | vout->smsshado_virt_addr[j] = 0; | 84 | vout->smsshado_size); |
85 | vout->smsshado_phy_addr[j] = 0; | 85 | vout->smsshado_virt_addr[j] = 0; |
86 | vout->smsshado_phy_addr[j] = 0; | ||
87 | } | ||
86 | } | 88 | } |
87 | } | 89 | } |
88 | 90 | ||