[1/4] omap iommu: Check existence of arch_iommu

Message ID 19F8576C6E063C45BE387C64729E739404E21D57E2@dbde02.ent.ti.com (mailing list archive)
State Superseded, archived
Headers

Commit Message

Hiremath, Vaibhav March 25, 2011, 7:07 p.m. UTC
  > -----Original Message-----
> From: linux-media-owner@vger.kernel.org [mailto:linux-media-
> owner@vger.kernel.org] On Behalf Of Sakari Ailus
> Sent: Friday, March 25, 2011 8:43 PM
> To: linux-media@vger.kernel.org
> Cc: laurent.pinchart@ideasonboard.com; david.cohen@nokia.com;
> hiroshi.doyu@nokia.com
> Subject: [PATCH 1/4] omap iommu: Check existence of arch_iommu
> 
> Check that the arch_iommu has been installed before trying to use it. This
> will lead to kernel oops if the arch_iommu isn't there.
> 
> Signed-off-by: Sakari Ailus <sakari.ailus@maxwell.research.nokia.com>
> ---
>  arch/arm/plat-omap/iommu.c |    3 +++
>  1 files changed, 3 insertions(+), 0 deletions(-)
> 
> diff --git a/arch/arm/plat-omap/iommu.c b/arch/arm/plat-omap/iommu.c
> index b1107c0..f0fea0b 100644
> --- a/arch/arm/plat-omap/iommu.c
> +++ b/arch/arm/plat-omap/iommu.c
> @@ -104,6 +104,9 @@ static int iommu_enable(struct iommu *obj)
>  	if (!obj)
>  		return -EINVAL;
> 
> +	if (!arch_iommu)
> +		return -ENOENT;
> +
[Hiremath, Vaibhav] Similar patch has already been submitted and accepted in community, not sure which baseline you are using. Please refer to below commit - 


commit ef4815ab1ff10d642c21ef92faa6544934bc78d1
Author: Martin Hostettler <martin@neutronstar.dyndns.org>
Date:   Thu Feb 24 12:51:31 2011 -0800

    omap: iommu: Gracefully fail iommu_enable if no arch_iommu is registered

    In a modular build of the iommu code it's possible that the arch iommu code
    isn't loaded when trying to enable the iommu. Instead of blindly following a
    null pointer return -NODEV in that case.

    Signed-off-by: Martin Hostettler <martin@neutronstar.dyndns.org>
    Signed-off-by: Tony Lindgren <tony@atomide.com>



Thanks,
Vaibhav

>  	clk_enable(obj->clk);
> 
>  	err = arch_iommu->enable(obj);
> --
> 1.7.2.3
> 
> --
> To unsubscribe from this list: send the line "unsubscribe linux-media" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html
--
To unsubscribe from this list: send the line "unsubscribe linux-media" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
  

Comments

Sakari Ailus March 27, 2011, 5:04 p.m. UTC | #1
Hiremath, Vaibhav wrote:
>> -----Original Message-----
>> From: linux-media-owner@vger.kernel.org [mailto:linux-media-
>> owner@vger.kernel.org] On Behalf Of Sakari Ailus
>> Sent: Friday, March 25, 2011 8:43 PM
>> To: linux-media@vger.kernel.org
>> Cc: laurent.pinchart@ideasonboard.com; david.cohen@nokia.com;
>> hiroshi.doyu@nokia.com
>> Subject: [PATCH 1/4] omap iommu: Check existence of arch_iommu
>>
>> Check that the arch_iommu has been installed before trying to use it. This
>> will lead to kernel oops if the arch_iommu isn't there.
>>
>> Signed-off-by: Sakari Ailus <sakari.ailus@maxwell.research.nokia.com>
>> ---
>>  arch/arm/plat-omap/iommu.c |    3 +++
>>  1 files changed, 3 insertions(+), 0 deletions(-)
>>
>> diff --git a/arch/arm/plat-omap/iommu.c b/arch/arm/plat-omap/iommu.c
>> index b1107c0..f0fea0b 100644
>> --- a/arch/arm/plat-omap/iommu.c
>> +++ b/arch/arm/plat-omap/iommu.c
>> @@ -104,6 +104,9 @@ static int iommu_enable(struct iommu *obj)
>>  	if (!obj)
>>  		return -EINVAL;
>>
>> +	if (!arch_iommu)
>> +		return -ENOENT;
>> +
> [Hiremath, Vaibhav] Similar patch has already been submitted and
accepted in community, not sure which baseline you are using. Please
refer to below commit -
> 

Thanks, Vaibhav. I guess I need to update my tree and resend the set...

Cheers,
  

Patch

diff --git a/arch/arm/plat-omap/iommu.c b/arch/arm/plat-omap/iommu.c
index b1107c0..3d8f55e 100644
--- a/arch/arm/plat-omap/iommu.c
+++ b/arch/arm/plat-omap/iommu.c
@@ -104,6 +104,9 @@  static int iommu_enable(struct iommu *obj)
        if (!obj)
                return -EINVAL;

+       if (!arch_iommu)
+               return -ENODEV;
+
        clk_enable(obj->clk);

        err = arch_iommu->enable(obj);