* [PATCH] drm/mediatek: check for memory allocation failure
@ 2017-06-09 19:27 Christophe JAILLET
2017-06-12 9:04 ` Matthias Brugger
2017-06-13 7:45 ` CK Hu
0 siblings, 2 replies; 3+ messages in thread
From: Christophe JAILLET @ 2017-06-09 19:27 UTC (permalink / raw)
To: linux-arm-kernel
If 'devm_kmalloc_array' returns NULL, we should return -ENOMEM as already
done a few lines above instead of deferencing a NULL pointer a few lines
below.
Signed-off-by: Christophe JAILLET <christophe.jaillet@wanadoo.fr>
---
drivers/gpu/drm/mediatek/mtk_drm_crtc.c | 2 ++
1 file changed, 2 insertions(+)
diff --git a/drivers/gpu/drm/mediatek/mtk_drm_crtc.c b/drivers/gpu/drm/mediatek/mtk_drm_crtc.c
index 6582e1f56d37..cb32c9369f3a 100644
--- a/drivers/gpu/drm/mediatek/mtk_drm_crtc.c
+++ b/drivers/gpu/drm/mediatek/mtk_drm_crtc.c
@@ -559,6 +559,8 @@ int mtk_drm_crtc_create(struct drm_device *drm_dev,
mtk_crtc->ddp_comp = devm_kmalloc_array(dev, mtk_crtc->ddp_comp_nr,
sizeof(*mtk_crtc->ddp_comp),
GFP_KERNEL);
+ if (!mtk_crtc->ddp_comp)
+ return -ENOMEM;
mtk_crtc->mutex = mtk_disp_mutex_get(priv->mutex_dev, pipe);
if (IS_ERR(mtk_crtc->mutex)) {
--
2.11.0
^ permalink raw reply related [flat|nested] 3+ messages in thread
* [PATCH] drm/mediatek: check for memory allocation failure
2017-06-09 19:27 [PATCH] drm/mediatek: check for memory allocation failure Christophe JAILLET
@ 2017-06-12 9:04 ` Matthias Brugger
2017-06-13 7:45 ` CK Hu
1 sibling, 0 replies; 3+ messages in thread
From: Matthias Brugger @ 2017-06-12 9:04 UTC (permalink / raw)
To: linux-arm-kernel
On 09/06/17 21:27, Christophe JAILLET wrote:
> If 'devm_kmalloc_array' returns NULL, we should return -ENOMEM as already
> done a few lines above instead of deferencing a NULL pointer a few lines
> below.
>
> Signed-off-by: Christophe JAILLET <christophe.jaillet@wanadoo.fr>
> ---
Reviewed-by: Matthias Brugger <matthias.bgg@gmail.com>
> drivers/gpu/drm/mediatek/mtk_drm_crtc.c | 2 ++
> 1 file changed, 2 insertions(+)
>
> diff --git a/drivers/gpu/drm/mediatek/mtk_drm_crtc.c b/drivers/gpu/drm/mediatek/mtk_drm_crtc.c
> index 6582e1f56d37..cb32c9369f3a 100644
> --- a/drivers/gpu/drm/mediatek/mtk_drm_crtc.c
> +++ b/drivers/gpu/drm/mediatek/mtk_drm_crtc.c
> @@ -559,6 +559,8 @@ int mtk_drm_crtc_create(struct drm_device *drm_dev,
> mtk_crtc->ddp_comp = devm_kmalloc_array(dev, mtk_crtc->ddp_comp_nr,
> sizeof(*mtk_crtc->ddp_comp),
> GFP_KERNEL);
> + if (!mtk_crtc->ddp_comp)
> + return -ENOMEM;
>
> mtk_crtc->mutex = mtk_disp_mutex_get(priv->mutex_dev, pipe);
> if (IS_ERR(mtk_crtc->mutex)) {
>
^ permalink raw reply [flat|nested] 3+ messages in thread
* [PATCH] drm/mediatek: check for memory allocation failure
2017-06-09 19:27 [PATCH] drm/mediatek: check for memory allocation failure Christophe JAILLET
2017-06-12 9:04 ` Matthias Brugger
@ 2017-06-13 7:45 ` CK Hu
1 sibling, 0 replies; 3+ messages in thread
From: CK Hu @ 2017-06-13 7:45 UTC (permalink / raw)
To: linux-arm-kernel
Hi, Christophe:
Applied to my branch mediatek-drm-next-4.13, thanks.
Regards,
CK
On Fri, 2017-06-09 at 21:27 +0200, Christophe JAILLET wrote:
> If 'devm_kmalloc_array' returns NULL, we should return -ENOMEM as already
> done a few lines above instead of deferencing a NULL pointer a few lines
> below.
>
> Signed-off-by: Christophe JAILLET <christophe.jaillet@wanadoo.fr>
> ---
> drivers/gpu/drm/mediatek/mtk_drm_crtc.c | 2 ++
> 1 file changed, 2 insertions(+)
>
> diff --git a/drivers/gpu/drm/mediatek/mtk_drm_crtc.c b/drivers/gpu/drm/mediatek/mtk_drm_crtc.c
> index 6582e1f56d37..cb32c9369f3a 100644
> --- a/drivers/gpu/drm/mediatek/mtk_drm_crtc.c
> +++ b/drivers/gpu/drm/mediatek/mtk_drm_crtc.c
> @@ -559,6 +559,8 @@ int mtk_drm_crtc_create(struct drm_device *drm_dev,
> mtk_crtc->ddp_comp = devm_kmalloc_array(dev, mtk_crtc->ddp_comp_nr,
> sizeof(*mtk_crtc->ddp_comp),
> GFP_KERNEL);
> + if (!mtk_crtc->ddp_comp)
> + return -ENOMEM;
>
> mtk_crtc->mutex = mtk_disp_mutex_get(priv->mutex_dev, pipe);
> if (IS_ERR(mtk_crtc->mutex)) {
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2017-06-13 7:45 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-06-09 19:27 [PATCH] drm/mediatek: check for memory allocation failure Christophe JAILLET
2017-06-12 9:04 ` Matthias Brugger
2017-06-13 7:45 ` CK Hu
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).