WSL2-Linux-Kernel/drivers/media
Colin Cross fee0c54e28 dma-buf: avoid using IS_ERR_OR_NULL
dma_buf_map_attachment and dma_buf_vmap can return NULL or
ERR_PTR on a error.  This encourages a common buggy pattern in
callers:
	sgt = dma_buf_map_attachment(attach, DMA_BIDIRECTIONAL);
	if (IS_ERR_OR_NULL(sgt))
                return PTR_ERR(sgt);

This causes the caller to return 0 on an error.  IS_ERR_OR_NULL
is almost always a sign of poorly-defined error handling.

This patch converts dma_buf_map_attachment to always return
ERR_PTR, and fixes the callers that incorrectly handled NULL.
There are a few more callers that were not checking for NULL
at all, which would have dereferenced a NULL pointer later.
There are also a few more callers that correctly handled NULL
and ERR_PTR differently, I left those alone but they could also
be modified to delete the NULL check.

This patch also converts dma_buf_vmap to always return NULL.
All the callers to dma_buf_vmap only check for NULL, and would
have dereferenced an ERR_PTR and panic'd if one was ever
returned. This is not consistent with the rest of the dma buf
APIs, but matches the expectations of all of the callers.

Signed-off-by: Colin Cross <ccross@android.com>
Reviewed-by: Rob Clark <robdclark@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2014-02-07 14:21:09 -08:00
..
common [media] media_tree: Fix spelling errors 2013-12-09 14:50:50 -02:00
dvb-core Merge branch 'v4l_for_linus' of git://git.kernel.org/pub/scm/linux/kernel/git/mchehab/linux-media 2014-01-31 09:31:14 -08:00
dvb-frontends [media] drxk: remove the option to load firmware asynchronously 2014-01-14 14:40:10 -02:00
firewire firewire: introduce fw_driver.probe and .remove methods 2013-06-09 18:15:00 +02:00
i2c [media] s5k5baf: Fix potential NULL pointer dereferencing 2014-01-07 08:48:46 -02:00
mmc
parport [media] bw-qcam: fix timestamp handling 2013-05-27 09:30:19 -03:00
pci [media] videodev2: Set vb2_rect's width and height as unsigned 2014-01-07 08:02:39 -02:00
platform Merge branch 'v4l_for_linus' of git://git.kernel.org/pub/scm/linux/kernel/git/mchehab/linux-media 2014-01-31 09:31:14 -08:00
radio [media] radio-usb-si4713: fix sparse non static symbol warnings 2014-01-15 09:12:51 -02:00
rc [media] rc-core: reuse device numbers 2014-01-15 11:46:37 -02:00
tuners [media] tuner-xc2028: Don't read status if device is powered down 2014-01-10 06:05:13 -02:00
usb [media] em28xx-cards: properly initialize the device bitmap 2014-01-15 11:46:20 -02:00
v4l2-core dma-buf: avoid using IS_ERR_OR_NULL 2014-02-07 14:21:09 -08:00
Kconfig [media] subdev autoselect only works if I2C and I2C_MUX is selected 2013-12-21 06:03:06 -02:00
Makefile
media-device.c [media] media: info leak in __media_device_enum_links() 2013-06-12 18:52:45 -03:00
media-devnode.c
media-entity.c [media] media: Check for active links on pads with MEDIA_PAD_FL_MUST_CONNECT flag 2013-12-04 15:03:45 -02:00