linux/drivers/gpu/drm/exynos
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
..
exynos_ddc.c
exynos_drm_buf.c
exynos_drm_buf.h
exynos_drm_connector.c
exynos_drm_connector.h
exynos_drm_core.c
exynos_drm_crtc.c
exynos_drm_crtc.h
exynos_drm_dmabuf.c dma-buf: avoid using IS_ERR_OR_NULL 2014-02-07 14:21:09 -08:00
exynos_drm_dmabuf.h
exynos_drm_drv.c
exynos_drm_drv.h
exynos_drm_encoder.c
exynos_drm_encoder.h
exynos_drm_fb.c
exynos_drm_fb.h
exynos_drm_fbdev.c
exynos_drm_fbdev.h
exynos_drm_fimc.c
exynos_drm_fimc.h
exynos_drm_fimd.c
exynos_drm_g2d.c
exynos_drm_g2d.h
exynos_drm_gem.c
exynos_drm_gem.h
exynos_drm_gsc.c
exynos_drm_gsc.h
exynos_drm_hdmi.c
exynos_drm_hdmi.h
exynos_drm_iommu.c
exynos_drm_iommu.h
exynos_drm_ipp.c
exynos_drm_ipp.h
exynos_drm_plane.c
exynos_drm_plane.h
exynos_drm_rotator.c
exynos_drm_rotator.h
exynos_drm_vidi.c
exynos_drm_vidi.h
exynos_hdmi.c
exynos_hdmi.h
exynos_hdmiphy.c
exynos_mixer.c
Kconfig
Makefile
regs-fimc.h
regs-gsc.h
regs-hdmi.h
regs-mixer.h
regs-rotator.h
regs-vp.h