diff mbox

omap: iommu: fixing NULL pointer return value

Message ID 1356096979-27698-1-git-send-email-g-aubertin@ti.com (mailing list archive)
State New, archived
Headers show

Commit Message

Guillaume Aubertin Dec. 21, 2012, 1:36 p.m. UTC
the returned NULL pointer is not detected by IS_ERR(), and then
de-referenced in the calling function, omap_iommu_attach_dev().

Signed-off-by: Guillaume Aubertin <g-aubertin@ti.com>
---
 drivers/iommu/omap-iommu.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

Comments

Ohad Ben Cohen Dec. 21, 2012, 1:39 p.m. UTC | #1
Hi Guillaume,

You should also cc Joerg and the iommu ml for iommu patches (cc'ing now).

On Fri, Dec 21, 2012 at 3:36 PM, Guillaume Aubertin <g-aubertin@ti.com> wrote:
> the returned NULL pointer is not detected by IS_ERR(), and then
> de-referenced in the calling function, omap_iommu_attach_dev().
>
> Signed-off-by: Guillaume Aubertin <g-aubertin@ti.com>

Acked-by: Ohad Ben-Cohen <ohad@wizery.com>

> ---
>  drivers/iommu/omap-iommu.c |    2 +-
>  1 files changed, 1 insertions(+), 1 deletions(-)
>
> diff --git a/drivers/iommu/omap-iommu.c b/drivers/iommu/omap-iommu.c
> index badc17c..a0fcad2 100644
> --- a/drivers/iommu/omap-iommu.c
> +++ b/drivers/iommu/omap-iommu.c
> @@ -861,7 +861,7 @@ static struct omap_iommu *omap_iommu_attach(const char *name, u32 *iopgd)
>                                 (void *)name,
>                                 device_match_by_alias);
>         if (!dev)
> -               return NULL;
> +               return ERR_PTR(-ENODEV);
>
>         obj = to_iommu(dev);
>
> --
> 1.7.0.4
>
--
To unsubscribe from this list: send the line "unsubscribe linux-omap" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
diff mbox

Patch

diff --git a/drivers/iommu/omap-iommu.c b/drivers/iommu/omap-iommu.c
index badc17c..a0fcad2 100644
--- a/drivers/iommu/omap-iommu.c
+++ b/drivers/iommu/omap-iommu.c
@@ -861,7 +861,7 @@  static struct omap_iommu *omap_iommu_attach(const char *name, u32 *iopgd)
 				(void *)name,
 				device_match_by_alias);
 	if (!dev)
-		return NULL;
+		return ERR_PTR(-ENODEV);
 
 	obj = to_iommu(dev);