From: Dan Carpenter <dan.carpenter@oracle.com>
To: jy0922.shim@samsung.com
Cc: linux-samsung-soc@vger.kernel.org
Subject: re: drm/exynos: merge exynos_drm_buf.c to exynos_drm_gem.c
Date: Wed, 19 Aug 2015 11:35:46 +0300 [thread overview]
Message-ID: <20150819083546.GA5271@mwanda> (raw)
Hello Joonyoung Shim,
The patch 2a8cb4894540: "drm/exynos: merge exynos_drm_buf.c to
exynos_drm_gem.c" from Aug 16, 2015, leads to the following static
checker warning:
drivers/gpu/drm/exynos/exynos_drm_gem.c:610 exynos_drm_gem_prime_import_sg_table()
error: 'exynos_gem_obj' dereferencing possible ERR_PTR()
drivers/gpu/drm/exynos/exynos_drm_gem.c
562 struct drm_gem_object *
563 exynos_drm_gem_prime_import_sg_table(struct drm_device *dev,
564 struct dma_buf_attachment *attach,
565 struct sg_table *sgt)
566 {
567 struct exynos_drm_gem_obj *exynos_gem_obj;
568 int npages;
569 int ret;
570
571 exynos_gem_obj = exynos_drm_gem_init(dev, attach->dmabuf->size);
572 if (IS_ERR(exynos_gem_obj)) {
573 ret = PTR_ERR(exynos_gem_obj);
exynos_gem_obj is an ERR_PTR.
574 goto err;
575 }
576
577 exynos_gem_obj->dma_addr = sg_dma_address(sgt->sgl);
603
604 return &exynos_gem_obj->base;
605
606 err_free_large:
607 drm_free_large(exynos_gem_obj->pages);
608 err:
609 drm_gem_object_release(&exynos_gem_obj->base);
610 kfree(exynos_gem_obj);
So both the drm_gem_object_release() and kfree() will crash. Do we
really need both? I feel like there should be a single free function
which undoes the exynos_drm_gem_init() function. Also the
exynos_drm_gem_init() has no documentation about how it is supposed to
be freed.
611 return ERR_PTR(ret);
612 }
regards,
dan carpenter
next reply other threads:[~2015-08-19 8:35 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-08-19 8:35 Dan Carpenter [this message]
2015-08-19 9:25 ` drm/exynos: merge exynos_drm_buf.c to exynos_drm_gem.c Joonyoung Shim
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=20150819083546.GA5271@mwanda \
--to=dan.carpenter@oracle.com \
--cc=jy0922.shim@samsung.com \
--cc=linux-samsung-soc@vger.kernel.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