Re: [PATCH] msm: iommu: fix leak and invalid access

2013-05-28 Thread Libo Chen
On 2013/5/28 20:27, Joerg Roedel wrote:
> On Wed, May 22, 2013 at 01:58:39PM +0800, Libo Chen wrote:
>>>
>>> This patch merge two patch that I sended before:
>>> 1. msm: iommu: add missing platform_device_unregister() in err case
>>> 2. msm: iommu: no need kfree before kzalloc successful
>>>
>>> It fixes two obvious problems:
>>> 1. We have registered msm_iommu_driver first, and need unregister it when
>>> registered msm_iommu_ctx_driver fail
>>>
>>> 2. We don`t need to kfree drvdata before kzalloc successful
>>>
>>> Signed-off-by: Libo Chen 
>>> ---
>>>  drivers/iommu/msm_iommu_dev.c |   11 +--
>>>  1 files changed, 5 insertions(+), 6 deletions(-)
> 
> Has this patch already been handled? If not please resend it to me and I
> will take care of it.
> 
> 

It should be included to -mm tree by Andrew Morton


Regards,

Libo

>   Joerg
> 
> 
> --
> To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
> the body of a message to majord...@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html
> Please read the FAQ at  http://www.tux.org/lkml/
> 
> .
> 


--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH] msm: iommu: fix leak and invalid access

2013-05-28 Thread Joerg Roedel
On Wed, May 22, 2013 at 01:58:39PM +0800, Libo Chen wrote:
> > 
> > This patch merge two patch that I sended before:
> > 1. msm: iommu: add missing platform_device_unregister() in err case
> > 2. msm: iommu: no need kfree before kzalloc successful
> > 
> > It fixes two obvious problems:
> > 1. We have registered msm_iommu_driver first, and need unregister it when
> > registered msm_iommu_ctx_driver fail
> > 
> > 2. We don`t need to kfree drvdata before kzalloc successful
> > 
> > Signed-off-by: Libo Chen 
> > ---
> >  drivers/iommu/msm_iommu_dev.c |   11 +--
> >  1 files changed, 5 insertions(+), 6 deletions(-)

Has this patch already been handled? If not please resend it to me and I
will take care of it.


Joerg


--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH] msm: iommu: fix leak and invalid access

2013-05-28 Thread Joerg Roedel
On Wed, May 22, 2013 at 01:58:39PM +0800, Libo Chen wrote:
  
  This patch merge two patch that I sended before:
  1. msm: iommu: add missing platform_device_unregister() in err case
  2. msm: iommu: no need kfree before kzalloc successful
  
  It fixes two obvious problems:
  1. We have registered msm_iommu_driver first, and need unregister it when
  registered msm_iommu_ctx_driver fail
  
  2. We don`t need to kfree drvdata before kzalloc successful
  
  Signed-off-by: Libo Chen libo.c...@huawei.com
  ---
   drivers/iommu/msm_iommu_dev.c |   11 +--
   1 files changed, 5 insertions(+), 6 deletions(-)

Has this patch already been handled? If not please resend it to me and I
will take care of it.


Joerg


--
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH] msm: iommu: fix leak and invalid access

2013-05-28 Thread Libo Chen
On 2013/5/28 20:27, Joerg Roedel wrote:
 On Wed, May 22, 2013 at 01:58:39PM +0800, Libo Chen wrote:

 This patch merge two patch that I sended before:
 1. msm: iommu: add missing platform_device_unregister() in err case
 2. msm: iommu: no need kfree before kzalloc successful

 It fixes two obvious problems:
 1. We have registered msm_iommu_driver first, and need unregister it when
 registered msm_iommu_ctx_driver fail

 2. We don`t need to kfree drvdata before kzalloc successful

 Signed-off-by: Libo Chen libo.c...@huawei.com
 ---
  drivers/iommu/msm_iommu_dev.c |   11 +--
  1 files changed, 5 insertions(+), 6 deletions(-)
 
 Has this patch already been handled? If not please resend it to me and I
 will take care of it.
 
 

It should be included to -mm tree by Andrew Morton


Regards,

Libo

   Joerg
 
 
 --
 To unsubscribe from this list: send the line unsubscribe linux-kernel in
 the body of a message to majord...@vger.kernel.org
 More majordomo info at  http://vger.kernel.org/majordomo-info.html
 Please read the FAQ at  http://www.tux.org/lkml/
 
 .
 


--
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH] msm: iommu: fix leak and invalid access

2013-05-23 Thread Andrew Morton
On Wed, 15 May 2013 12:47:03 +0800 Libo Chen  
wrote:

> It fixes two obvious problems:
> 1. We have registered msm_iommu_driver first, and need unregister it when
> registered msm_iommu_ctx_driver fail

yup, that's a bug.

> 2. We don`t need to kfree drvdata before kzalloc successful

The code's OK at present - kfree(NULL) is legal.

However I suppose the patch cleans things up a little bit, however it
missed a couple of things:



From: Andrew Morton 
Subject: drivers-iommu-msm_iommu_devc-fix-leak-and-invalid-access-fix

remove now-unneeded initialization of ctx_drvdata, remove unneeded braces

Cc: David Brown 
Cc: David Woodhouse 
Cc: James Hogan 
Cc: Libo Chen 
Cc: Libo Chen 
Signed-off-by: Andrew Morton 
---

 drivers/iommu/msm_iommu_dev.c |   13 +
 1 file changed, 5 insertions(+), 8 deletions(-)

diff -puN 
drivers/iommu/msm_iommu_dev.c~drivers-iommu-msm_iommu_devc-fix-leak-and-invalid-access-fix
 drivers/iommu/msm_iommu_dev.c
--- 
a/drivers/iommu/msm_iommu_dev.c~drivers-iommu-msm_iommu_devc-fix-leak-and-invalid-access-fix
+++ a/drivers/iommu/msm_iommu_dev.c
@@ -289,22 +289,19 @@ static int msm_iommu_ctx_probe(struct pl
 {
struct msm_iommu_ctx_dev *c = pdev->dev.platform_data;
struct msm_iommu_drvdata *drvdata;
-   struct msm_iommu_ctx_drvdata *ctx_drvdata = NULL;
+   struct msm_iommu_ctx_drvdata *ctx_drvdata;
int i, ret;
-   if (!c || !pdev->dev.parent) {
+
+   if (!c || !pdev->dev.parent)
return -EINVAL;
-   }
 
drvdata = dev_get_drvdata(pdev->dev.parent);
-
-   if (!drvdata) {
+   if (!drvdata)
return -ENODEV;
-   }
 
ctx_drvdata = kzalloc(sizeof(*ctx_drvdata), GFP_KERNEL);
-   if (!ctx_drvdata) {
+   if (!ctx_drvdata)
return -ENOMEM;
-   }
 
ctx_drvdata->num = c->num;
ctx_drvdata->pdev = pdev;
_

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH] msm: iommu: fix leak and invalid access

2013-05-23 Thread Andrew Morton
On Wed, 15 May 2013 12:47:03 +0800 Libo Chen clbchenlibo.c...@huawei.com 
wrote:

 It fixes two obvious problems:
 1. We have registered msm_iommu_driver first, and need unregister it when
 registered msm_iommu_ctx_driver fail

yup, that's a bug.

 2. We don`t need to kfree drvdata before kzalloc successful

The code's OK at present - kfree(NULL) is legal.

However I suppose the patch cleans things up a little bit, however it
missed a couple of things:



From: Andrew Morton a...@linux-foundation.org
Subject: drivers-iommu-msm_iommu_devc-fix-leak-and-invalid-access-fix

remove now-unneeded initialization of ctx_drvdata, remove unneeded braces

Cc: David Brown dav...@codeaurora.org
Cc: David Woodhouse dw...@infradead.org
Cc: James Hogan james.ho...@imgtec.com
Cc: Libo Chen clbchenlibo.c...@huawei.com
Cc: Libo Chen libo.c...@huawei.com
Signed-off-by: Andrew Morton a...@linux-foundation.org
---

 drivers/iommu/msm_iommu_dev.c |   13 +
 1 file changed, 5 insertions(+), 8 deletions(-)

diff -puN 
drivers/iommu/msm_iommu_dev.c~drivers-iommu-msm_iommu_devc-fix-leak-and-invalid-access-fix
 drivers/iommu/msm_iommu_dev.c
--- 
a/drivers/iommu/msm_iommu_dev.c~drivers-iommu-msm_iommu_devc-fix-leak-and-invalid-access-fix
+++ a/drivers/iommu/msm_iommu_dev.c
@@ -289,22 +289,19 @@ static int msm_iommu_ctx_probe(struct pl
 {
struct msm_iommu_ctx_dev *c = pdev-dev.platform_data;
struct msm_iommu_drvdata *drvdata;
-   struct msm_iommu_ctx_drvdata *ctx_drvdata = NULL;
+   struct msm_iommu_ctx_drvdata *ctx_drvdata;
int i, ret;
-   if (!c || !pdev-dev.parent) {
+
+   if (!c || !pdev-dev.parent)
return -EINVAL;
-   }
 
drvdata = dev_get_drvdata(pdev-dev.parent);
-
-   if (!drvdata) {
+   if (!drvdata)
return -ENODEV;
-   }
 
ctx_drvdata = kzalloc(sizeof(*ctx_drvdata), GFP_KERNEL);
-   if (!ctx_drvdata) {
+   if (!ctx_drvdata)
return -ENOMEM;
-   }
 
ctx_drvdata-num = c-num;
ctx_drvdata-pdev = pdev;
_

--
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH] msm: iommu: fix leak and invalid access

2013-05-22 Thread Libo Chen
On 2013/5/23 6:29, David Brown wrote:
> On Wed, May 22, 2013 at 01:58:39PM +0800, Libo Chen wrote:
> 
>> > ping...
> This is the first I've seen this patch.  The original appears to have
> been sent to Andrew Morton and lkml.  I'll reply with an Ack there.
> 
> David

Regards

Libo

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH] msm: iommu: fix leak and invalid access

2013-05-22 Thread David Brown
On Wed, May 15, 2013 at 12:47:03PM +0800, Libo Chen wrote:

> This patch merge two patch that I sended before:
> 1. msm: iommu: add missing platform_device_unregister() in err case
> 2. msm: iommu: no need kfree before kzalloc successful
> 
> It fixes two obvious problems:
> 1. We have registered msm_iommu_driver first, and need unregister it when
> registered msm_iommu_ctx_driver fail
> 
> 2. We don`t need to kfree drvdata before kzalloc successful
> 
> Signed-off-by: Libo Chen 
> ---
>  drivers/iommu/msm_iommu_dev.c |   11 +--
>  1 files changed, 5 insertions(+), 6 deletions(-)

Acked-by: David Brown 

-- 
sent by an employee of the Qualcomm Innovation Center, Inc.
The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum,
hosted by The Linux Foundation
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH] msm: iommu: fix leak and invalid access

2013-05-22 Thread David Brown
On Wed, May 22, 2013 at 01:58:39PM +0800, Libo Chen wrote:

> ping...

This is the first I've seen this patch.  The original appears to have
been sent to Andrew Morton and lkml.  I'll reply with an Ack there.

David

-- 
sent by an employee of the Qualcomm Innovation Center, Inc.
The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum,
hosted by The Linux Foundation
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH] msm: iommu: fix leak and invalid access

2013-05-22 Thread Libo Chen

ping...

On 2013/5/15 12:47, Libo Chen wrote:
> 
> This patch merge two patch that I sended before:
> 1. msm: iommu: add missing platform_device_unregister() in err case
> 2. msm: iommu: no need kfree before kzalloc successful
> 
> It fixes two obvious problems:
> 1. We have registered msm_iommu_driver first, and need unregister it when
> registered msm_iommu_ctx_driver fail
> 
> 2. We don`t need to kfree drvdata before kzalloc successful
> 
> Signed-off-by: Libo Chen 
> ---
>  drivers/iommu/msm_iommu_dev.c |   11 +--
>  1 files changed, 5 insertions(+), 6 deletions(-)
> 
> diff --git a/drivers/iommu/msm_iommu_dev.c b/drivers/iommu/msm_iommu_dev.c
> index 8e8fb07..bae0b23 100644
> --- a/drivers/iommu/msm_iommu_dev.c
> +++ b/drivers/iommu/msm_iommu_dev.c
> @@ -292,22 +292,20 @@ static int msm_iommu_ctx_probe(struct platform_device 
> *pdev)
>   struct msm_iommu_ctx_drvdata *ctx_drvdata = NULL;
>   int i, ret;
>   if (!c || !pdev->dev.parent) {
> - ret = -EINVAL;
> - goto fail;
> + return -EINVAL;
>   }
> 
>   drvdata = dev_get_drvdata(pdev->dev.parent);
> 
>   if (!drvdata) {
> - ret = -ENODEV;
> - goto fail;
> + return -ENODEV;
>   }
> 
>   ctx_drvdata = kzalloc(sizeof(*ctx_drvdata), GFP_KERNEL);
>   if (!ctx_drvdata) {
> - ret = -ENOMEM;
> - goto fail;
> + return -ENOMEM;
>   }
> +
>   ctx_drvdata->num = c->num;
>   ctx_drvdata->pdev = pdev;
> 
> @@ -401,6 +399,7 @@ static int __init msm_iommu_driver_init(void)
> 
>   ret = platform_driver_register(_iommu_ctx_driver);
>   if (ret != 0) {
> + platform_driver_unregister(_iommu_driver);
>   pr_err("Failed to register IOMMU context driver\n");
>   goto error;
>   }
> 


--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH] msm: iommu: fix leak and invalid access

2013-05-22 Thread Libo Chen

ping...

On 2013/5/15 12:47, Libo Chen wrote:
 
 This patch merge two patch that I sended before:
 1. msm: iommu: add missing platform_device_unregister() in err case
 2. msm: iommu: no need kfree before kzalloc successful
 
 It fixes two obvious problems:
 1. We have registered msm_iommu_driver first, and need unregister it when
 registered msm_iommu_ctx_driver fail
 
 2. We don`t need to kfree drvdata before kzalloc successful
 
 Signed-off-by: Libo Chen libo.c...@huawei.com
 ---
  drivers/iommu/msm_iommu_dev.c |   11 +--
  1 files changed, 5 insertions(+), 6 deletions(-)
 
 diff --git a/drivers/iommu/msm_iommu_dev.c b/drivers/iommu/msm_iommu_dev.c
 index 8e8fb07..bae0b23 100644
 --- a/drivers/iommu/msm_iommu_dev.c
 +++ b/drivers/iommu/msm_iommu_dev.c
 @@ -292,22 +292,20 @@ static int msm_iommu_ctx_probe(struct platform_device 
 *pdev)
   struct msm_iommu_ctx_drvdata *ctx_drvdata = NULL;
   int i, ret;
   if (!c || !pdev-dev.parent) {
 - ret = -EINVAL;
 - goto fail;
 + return -EINVAL;
   }
 
   drvdata = dev_get_drvdata(pdev-dev.parent);
 
   if (!drvdata) {
 - ret = -ENODEV;
 - goto fail;
 + return -ENODEV;
   }
 
   ctx_drvdata = kzalloc(sizeof(*ctx_drvdata), GFP_KERNEL);
   if (!ctx_drvdata) {
 - ret = -ENOMEM;
 - goto fail;
 + return -ENOMEM;
   }
 +
   ctx_drvdata-num = c-num;
   ctx_drvdata-pdev = pdev;
 
 @@ -401,6 +399,7 @@ static int __init msm_iommu_driver_init(void)
 
   ret = platform_driver_register(msm_iommu_ctx_driver);
   if (ret != 0) {
 + platform_driver_unregister(msm_iommu_driver);
   pr_err(Failed to register IOMMU context driver\n);
   goto error;
   }
 


--
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH] msm: iommu: fix leak and invalid access

2013-05-22 Thread David Brown
On Wed, May 22, 2013 at 01:58:39PM +0800, Libo Chen wrote:

 ping...

This is the first I've seen this patch.  The original appears to have
been sent to Andrew Morton and lkml.  I'll reply with an Ack there.

David

-- 
sent by an employee of the Qualcomm Innovation Center, Inc.
The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum,
hosted by The Linux Foundation
--
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH] msm: iommu: fix leak and invalid access

2013-05-22 Thread David Brown
On Wed, May 15, 2013 at 12:47:03PM +0800, Libo Chen wrote:

 This patch merge two patch that I sended before:
 1. msm: iommu: add missing platform_device_unregister() in err case
 2. msm: iommu: no need kfree before kzalloc successful
 
 It fixes two obvious problems:
 1. We have registered msm_iommu_driver first, and need unregister it when
 registered msm_iommu_ctx_driver fail
 
 2. We don`t need to kfree drvdata before kzalloc successful
 
 Signed-off-by: Libo Chen libo.c...@huawei.com
 ---
  drivers/iommu/msm_iommu_dev.c |   11 +--
  1 files changed, 5 insertions(+), 6 deletions(-)

Acked-by: David Brown dav...@codeaurora.org

-- 
sent by an employee of the Qualcomm Innovation Center, Inc.
The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum,
hosted by The Linux Foundation
--
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH] msm: iommu: fix leak and invalid access

2013-05-22 Thread Libo Chen
On 2013/5/23 6:29, David Brown wrote:
 On Wed, May 22, 2013 at 01:58:39PM +0800, Libo Chen wrote:
 
  ping...
 This is the first I've seen this patch.  The original appears to have
 been sent to Andrew Morton and lkml.  I'll reply with an Ack there.
 
 David

Regards

Libo

--
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH] msm: iommu: fix leak and invalid access

2013-05-14 Thread Libo Chen

This patch merge two patch that I sended before:
1. msm: iommu: add missing platform_device_unregister() in err case
2. msm: iommu: no need kfree before kzalloc successful

It fixes two obvious problems:
1. We have registered msm_iommu_driver first, and need unregister it when
registered msm_iommu_ctx_driver fail

2. We don`t need to kfree drvdata before kzalloc successful

Signed-off-by: Libo Chen 
---
 drivers/iommu/msm_iommu_dev.c |   11 +--
 1 files changed, 5 insertions(+), 6 deletions(-)

diff --git a/drivers/iommu/msm_iommu_dev.c b/drivers/iommu/msm_iommu_dev.c
index 8e8fb07..bae0b23 100644
--- a/drivers/iommu/msm_iommu_dev.c
+++ b/drivers/iommu/msm_iommu_dev.c
@@ -292,22 +292,20 @@ static int msm_iommu_ctx_probe(struct platform_device 
*pdev)
struct msm_iommu_ctx_drvdata *ctx_drvdata = NULL;
int i, ret;
if (!c || !pdev->dev.parent) {
-   ret = -EINVAL;
-   goto fail;
+   return -EINVAL;
}

drvdata = dev_get_drvdata(pdev->dev.parent);

if (!drvdata) {
-   ret = -ENODEV;
-   goto fail;
+   return -ENODEV;
}

ctx_drvdata = kzalloc(sizeof(*ctx_drvdata), GFP_KERNEL);
if (!ctx_drvdata) {
-   ret = -ENOMEM;
-   goto fail;
+   return -ENOMEM;
}
+
ctx_drvdata->num = c->num;
ctx_drvdata->pdev = pdev;

@@ -401,6 +399,7 @@ static int __init msm_iommu_driver_init(void)

ret = platform_driver_register(_iommu_ctx_driver);
if (ret != 0) {
+   platform_driver_unregister(_iommu_driver);
pr_err("Failed to register IOMMU context driver\n");
goto error;
}
-- 
1.7.1


--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH] msm: iommu: fix leak and invalid access

2013-05-14 Thread Libo Chen

This patch merge two patch that I sended before:
1. msm: iommu: add missing platform_device_unregister() in err case
2. msm: iommu: no need kfree before kzalloc successful

It fixes two obvious problems:
1. We have registered msm_iommu_driver first, and need unregister it when
registered msm_iommu_ctx_driver fail

2. We don`t need to kfree drvdata before kzalloc successful

Signed-off-by: Libo Chen libo.c...@huawei.com
---
 drivers/iommu/msm_iommu_dev.c |   11 +--
 1 files changed, 5 insertions(+), 6 deletions(-)

diff --git a/drivers/iommu/msm_iommu_dev.c b/drivers/iommu/msm_iommu_dev.c
index 8e8fb07..bae0b23 100644
--- a/drivers/iommu/msm_iommu_dev.c
+++ b/drivers/iommu/msm_iommu_dev.c
@@ -292,22 +292,20 @@ static int msm_iommu_ctx_probe(struct platform_device 
*pdev)
struct msm_iommu_ctx_drvdata *ctx_drvdata = NULL;
int i, ret;
if (!c || !pdev-dev.parent) {
-   ret = -EINVAL;
-   goto fail;
+   return -EINVAL;
}

drvdata = dev_get_drvdata(pdev-dev.parent);

if (!drvdata) {
-   ret = -ENODEV;
-   goto fail;
+   return -ENODEV;
}

ctx_drvdata = kzalloc(sizeof(*ctx_drvdata), GFP_KERNEL);
if (!ctx_drvdata) {
-   ret = -ENOMEM;
-   goto fail;
+   return -ENOMEM;
}
+
ctx_drvdata-num = c-num;
ctx_drvdata-pdev = pdev;

@@ -401,6 +399,7 @@ static int __init msm_iommu_driver_init(void)

ret = platform_driver_register(msm_iommu_ctx_driver);
if (ret != 0) {
+   platform_driver_unregister(msm_iommu_driver);
pr_err(Failed to register IOMMU context driver\n);
goto error;
}
-- 
1.7.1


--
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/