linux-arm-kernel.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
From: ck.hu@mediatek.com (CK Hu)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH] drm/mediatek: check for memory allocation failure
Date: Tue, 13 Jun 2017 15:45:20 +0800	[thread overview]
Message-ID: <1497339920.16952.2.camel@mtksdaap41> (raw)
In-Reply-To: <20170609192712.18155-1-christophe.jaillet@wanadoo.fr>

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)) {

      parent reply	other threads:[~2017-06-13  7:45 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
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 message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1497339920.16952.2.camel@mtksdaap41 \
    --to=ck.hu@mediatek.com \
    --cc=linux-arm-kernel@lists.infradead.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).