* [patch] drm/hisilicon/hibmc: Checking for NULL instead of IS_ERR()
@ 2016-11-24 11:35 Dan Carpenter
2016-11-25 6:43 ` Daniel Vetter
0 siblings, 1 reply; 2+ messages in thread
From: Dan Carpenter @ 2016-11-24 11:35 UTC (permalink / raw)
To: Xinliang Liu, Rongrong Zou; +Cc: Chen Feng, kernel-janitors, dri-devel
The drm_dev_alloc() function returns error pointers. It never returns
NULLs.
Fixes: 5e0df3a08f3d ("drm/hisilicon/hibmc: Add hisilicon hibmc drm master driver")
Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
diff --git a/drivers/gpu/drm/hisilicon/hibmc/hibmc_drm_drv.c b/drivers/gpu/drm/hisilicon/hibmc/hibmc_drm_drv.c
index 73ba8b0..d94e349 100644
--- a/drivers/gpu/drm/hisilicon/hibmc/hibmc_drm_drv.c
+++ b/drivers/gpu/drm/hisilicon/hibmc/hibmc_drm_drv.c
@@ -377,9 +377,9 @@ static int hibmc_pci_probe(struct pci_dev *pdev,
int ret;
dev = drm_dev_alloc(&hibmc_driver, &pdev->dev);
- if (!dev) {
+ if (IS_ERR(dev)) {
DRM_ERROR("failed to allocate drm_device\n");
- return -ENOMEM;
+ return PTR_ERR(dev);
}
dev->pdev = pdev;
^ permalink raw reply related [flat|nested] 2+ messages in thread* Re: [patch] drm/hisilicon/hibmc: Checking for NULL instead of IS_ERR()
2016-11-24 11:35 [patch] drm/hisilicon/hibmc: Checking for NULL instead of IS_ERR() Dan Carpenter
@ 2016-11-25 6:43 ` Daniel Vetter
0 siblings, 0 replies; 2+ messages in thread
From: Daniel Vetter @ 2016-11-25 6:43 UTC (permalink / raw)
To: Dan Carpenter
Cc: Xinliang Liu, Rongrong Zou, kernel-janitors, dri-devel, Chen Feng
On Thu, Nov 24, 2016 at 02:35:45PM +0300, Dan Carpenter wrote:
> The drm_dev_alloc() function returns error pointers. It never returns
> NULLs.
>
> Fixes: 5e0df3a08f3d ("drm/hisilicon/hibmc: Add hisilicon hibmc drm master driver")
> Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
Applied to drm-misc, thanks.
-Daniel
>
> diff --git a/drivers/gpu/drm/hisilicon/hibmc/hibmc_drm_drv.c b/drivers/gpu/drm/hisilicon/hibmc/hibmc_drm_drv.c
> index 73ba8b0..d94e349 100644
> --- a/drivers/gpu/drm/hisilicon/hibmc/hibmc_drm_drv.c
> +++ b/drivers/gpu/drm/hisilicon/hibmc/hibmc_drm_drv.c
> @@ -377,9 +377,9 @@ static int hibmc_pci_probe(struct pci_dev *pdev,
> int ret;
>
> dev = drm_dev_alloc(&hibmc_driver, &pdev->dev);
> - if (!dev) {
> + if (IS_ERR(dev)) {
> DRM_ERROR("failed to allocate drm_device\n");
> - return -ENOMEM;
> + return PTR_ERR(dev);
> }
>
> dev->pdev = pdev;
> _______________________________________________
> dri-devel mailing list
> dri-devel@lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/dri-devel
--
Daniel Vetter
Software Engineer, Intel Corporation
http://blog.ffwll.ch
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2016-11-25 6:43 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-11-24 11:35 [patch] drm/hisilicon/hibmc: Checking for NULL instead of IS_ERR() Dan Carpenter
2016-11-25 6:43 ` Daniel Vetter
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox