drm/tegra: checking IS_ERR() instead of NULL
PATCH 1/1 drm/tegra: checking IS_ERR() instead of NULL
iommu_domain_alloc() returns NULL on error, it never returns error pointers.
drivers/gpu/drm/tegra/drm.c +2 -2
@@ -36,8 +36,8 @@ static int tegra_drm_load(struct drm_device *drm, unsigned long flags)if (iommu_present (&platform_bus_type)) { tegra->domain =iommu_domain_alloc (&platform_bus_type); -if (IS_ERR (tegra->domain)) { - err =PTR_ERR (tegra->domain); +if (!tegra->domain) { + err = -ENOMEM ; goto free; }
Quoted 10 lines · Dan Carpenter
iommu_domain_alloc()returns NULL on error, it never returns error pointers.Signed-off-by Dan Carpenter <[email protected]>drivers/gpu/drm/tegra/drm.c +0
-0
drivers/gpu/drm/tegra/drm.c static int tegra_drm_load(struct drm_device *drm, unsigned long flags) · line 42
Quoted 9 lines
drivers/gpu/drm/tegra/drm.c +2
-2@@ -36,8 +36,8 @@ static int tegra_drm_load(struct drm_device *drm, unsigned long flags)if (iommu_present (&platform_bus_type)) { tegra->domain =iommu_domain_alloc (&platform_bus_type); -if (IS_ERR (tegra->domain)) { - err =PTR_ERR (tegra->domain); +if (!tegra->domain) { + err = -ENOMEM ; goto free; }
Oh, good catch. Applied, thanks.
Thierry
A message that is not in the archive (sent off-list or not yet received): 20141204132349.GD7262-AwZRO8vwLAwmlAP/[email protected]
Quoted 6 lines
Quoted 6 lines
drivers/gpu/drm/tegra/drm.c +0
-0@@ -36,8 +36,8 @@ static int tegra_drm_load(struct drm_device *drm, unsigned long flags)
Quoted 10 lines
drivers/gpu/drm/tegra/drm.c static int tegra_drm_load(struct drm_device *drm, unsigned long flags) · line 42
Quoted 8 lines
drivers/gpu/drm/tegra/drm.c +2
-2if (iommu_present (&platform_bus_type)) { tegra->domain =iommu_domain_alloc (&platform_bus_type); -if (IS_ERR (tegra->domain)) { - err =PTR_ERR (tegra->domain); +if (!tegra->domain) { + err = -ENOMEM ; goto free; }Oh, good catch. Applied, thanks.
How do you think about to amend the commit title?
Is the following wording more appropriate? drm/tegra: Checking for NULL pointer instead of IS_ERR() usage
Regards,
Markus
A message that is not in the archive (sent off-list or not yet received): 54819FFF.4000907-Rn4VEauK+AKRv+LV9MX5uipxlwaOVQ5f@public.gmane.org
Quoted 17 lines · SF Markus Elfring
Quoted 6 lines
Quoted 6 lines
drivers/gpu/drm/tegra/drm.c +0
-0@@ -36,8 +36,8 @@ static int tegra_drm_load(struct drm_device *drm, unsigned long flags)Quoted 10 lines
drivers/gpu/drm/tegra/drm.c static int tegra_drm_load(struct drm_device *drm, unsigned long flags) · line 42
Quoted 8 lines
drivers/gpu/drm/tegra/drm.c +2
-2if (iommu_present (&platform_bus_type)) { tegra->domain =iommu_domain_alloc (&platform_bus_type); -if (IS_ERR (tegra->domain)) { - err =PTR_ERR (tegra->domain); +if (!tegra->domain) { + err = -ENOMEM ; goto free; }Oh, good catch. Applied, thanks.
Quoted 4 lines
How do you think about to amend the commit title?
Is the following wording more appropriate? drm/tegra: Checking for NULL pointer instead of
IS_ERR()usage
Sounds better yes. I've gone with:
drm/tegra: Check for NULL pointer instead of IS_ERR()
Thierry