All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH v2 0/2] i2c: fix two wrong mem release
@ 2013-05-09  8:27 ` Libo Chen
  0 siblings, 0 replies; 20+ messages in thread
From: Libo Chen @ 2013-05-09  8:27 UTC (permalink / raw)
  To: Sonic.Zhang, wsa
  Cc: uclinux-dist-devel, linux-kernel, linux-i2c, lizefan, Libo Chen

fix two wrong mem release

* Changelog from v1:
  * exchange out_error_no_irq and out_error_pin_mux  suggested by Sonic <Sonic.Zhang@analog.com>  
  * add some new tag , make code cleanly

Libo Chen (2):
  i2c: i2c-bfin-twi: don`t free peripheral before it init successful
  i2c: pxa: no need release_mem_region before request_mem_region
    successful

 drivers/i2c/busses/i2c-bfin-twi.c |    2 +-
 drivers/i2c/busses/i2c-pxa.c      |   13 ++++++++-----
 2 files changed, 9 insertions(+), 6 deletions(-)



^ permalink raw reply	[flat|nested] 20+ messages in thread

* [PATCH v2 0/2] i2c: fix two wrong mem release
@ 2013-05-09  8:27 ` Libo Chen
  0 siblings, 0 replies; 20+ messages in thread
From: Libo Chen @ 2013-05-09  8:27 UTC (permalink / raw)
  To: Sonic.Zhang, wsa
  Cc: uclinux-dist-devel, linux-kernel, linux-i2c, lizefan, Libo Chen

fix two wrong mem release

* Changelog from v1:
  * exchange out_error_no_irq and out_error_pin_mux  suggested by Sonic <Sonic.Zhang@analog.com>  
  * add some new tag , make code cleanly

Libo Chen (2):
  i2c: i2c-bfin-twi: don`t free peripheral before it init successful
  i2c: pxa: no need release_mem_region before request_mem_region
    successful

 drivers/i2c/busses/i2c-bfin-twi.c |    2 +-
 drivers/i2c/busses/i2c-pxa.c      |   13 ++++++++-----
 2 files changed, 9 insertions(+), 6 deletions(-)

^ permalink raw reply	[flat|nested] 20+ messages in thread

* [PATCH v2 1/2] i2c: i2c-bfin-twi: don`t free peripheral before it init successful
  2013-05-09  8:27 ` Libo Chen
@ 2013-05-09  8:27   ` Libo Chen
  -1 siblings, 0 replies; 20+ messages in thread
From: Libo Chen @ 2013-05-09  8:27 UTC (permalink / raw)
  To: Sonic.Zhang, wsa
  Cc: uclinux-dist-devel, linux-kernel, linux-i2c, lizefan, Libo Chen

down out_error_no_irq. When platform_get_irq fail, no need to free peripheral

Signed-off-by: Libo Chen <libo.chen@huawei.com>
---
 drivers/i2c/busses/i2c-bfin-twi.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/drivers/i2c/busses/i2c-bfin-twi.c b/drivers/i2c/busses/i2c-bfin-twi.c
index 05080c4..6617645 100644
--- a/drivers/i2c/busses/i2c-bfin-twi.c
+++ b/drivers/i2c/busses/i2c-bfin-twi.c
@@ -709,9 +709,9 @@ static int i2c_bfin_twi_probe(struct platform_device *pdev)
 out_error_add_adapter:
 	free_irq(iface->irq, iface);
 out_error_req_irq:
-out_error_no_irq:
 	peripheral_free_list((unsigned short *)pdev->dev.platform_data);
 out_error_pin_mux:
+out_error_no_irq:
 	iounmap(iface->regs_base);
 out_error_ioremap:
 out_error_get_res:
-- 
1.7.1



^ permalink raw reply related	[flat|nested] 20+ messages in thread

* [PATCH v2 1/2] i2c: i2c-bfin-twi: don`t free peripheral before it init successful
@ 2013-05-09  8:27   ` Libo Chen
  0 siblings, 0 replies; 20+ messages in thread
From: Libo Chen @ 2013-05-09  8:27 UTC (permalink / raw)
  To: Sonic.Zhang, wsa
  Cc: uclinux-dist-devel, linux-kernel, linux-i2c, lizefan, Libo Chen

down out_error_no_irq. When platform_get_irq fail, no need to free peripheral

Signed-off-by: Libo Chen <libo.chen@huawei.com>
---
 drivers/i2c/busses/i2c-bfin-twi.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/drivers/i2c/busses/i2c-bfin-twi.c b/drivers/i2c/busses/i2c-bfin-twi.c
index 05080c4..6617645 100644
--- a/drivers/i2c/busses/i2c-bfin-twi.c
+++ b/drivers/i2c/busses/i2c-bfin-twi.c
@@ -709,9 +709,9 @@ static int i2c_bfin_twi_probe(struct platform_device *pdev)
 out_error_add_adapter:
 	free_irq(iface->irq, iface);
 out_error_req_irq:
-out_error_no_irq:
 	peripheral_free_list((unsigned short *)pdev->dev.platform_data);
 out_error_pin_mux:
+out_error_no_irq:
 	iounmap(iface->regs_base);
 out_error_ioremap:
 out_error_get_res:
-- 
1.7.1

^ permalink raw reply related	[flat|nested] 20+ messages in thread

* [PATCH v2 2/2] i2c: pxa: no need release_mem_region before request_mem_region successful
  2013-05-09  8:27 ` Libo Chen
@ 2013-05-09  8:27   ` Libo Chen
  -1 siblings, 0 replies; 20+ messages in thread
From: Libo Chen @ 2013-05-09  8:27 UTC (permalink / raw)
  To: Sonic.Zhang, wsa
  Cc: uclinux-dist-devel, linux-kernel, linux-i2c, lizefan, Libo Chen

When kzalloc fail, there is no reason to release_mem_region

fix confuse tag, add new tag: emem, eirq, edt and make it cleanly

Signed-off-by: Libo Chen <libo.chen@huawei.com>
---
 drivers/i2c/busses/i2c-pxa.c |   13 ++++++++-----
 1 files changed, 8 insertions(+), 5 deletions(-)

diff --git a/drivers/i2c/busses/i2c-pxa.c b/drivers/i2c/busses/i2c-pxa.c
index ea6d45d..a9da954 100644
--- a/drivers/i2c/busses/i2c-pxa.c
+++ b/drivers/i2c/busses/i2c-pxa.c
@@ -1104,18 +1104,18 @@ static int i2c_pxa_probe(struct platform_device *dev)
 	if (ret > 0)
 		ret = i2c_pxa_probe_pdata(dev, i2c, &i2c_type);
 	if (ret < 0)
-		goto eclk;
+		goto edt;
 
 	res = platform_get_resource(dev, IORESOURCE_MEM, 0);
 	irq = platform_get_irq(dev, 0);
 	if (res == NULL || irq < 0) {
 		ret = -ENODEV;
-		goto eclk;
+		goto eirq;
 	}
 
 	if (!request_mem_region(res->start, resource_size(res), res->name)) {
 		ret = -ENOMEM;
-		goto eclk;
+		goto emem;
 	}
 
 	i2c->adap.owner   = THIS_MODULE;
@@ -1207,9 +1207,12 @@ ereqirq:
 eremap:
 	clk_put(i2c->clk);
 eclk:
-	kfree(i2c);
-emalloc:
 	release_mem_region(res->start, resource_size(res));
+emem:
+eirq:
+edt:
+	kfree(i2c);
+emalloc:	
 	return ret;
 }
 
-- 
1.7.1



^ permalink raw reply related	[flat|nested] 20+ messages in thread

* [PATCH v2 2/2] i2c: pxa: no need release_mem_region before request_mem_region successful
@ 2013-05-09  8:27   ` Libo Chen
  0 siblings, 0 replies; 20+ messages in thread
From: Libo Chen @ 2013-05-09  8:27 UTC (permalink / raw)
  To: Sonic.Zhang, wsa
  Cc: uclinux-dist-devel, linux-kernel, linux-i2c, lizefan, Libo Chen

When kzalloc fail, there is no reason to release_mem_region

fix confuse tag, add new tag: emem, eirq, edt and make it cleanly

Signed-off-by: Libo Chen <libo.chen@huawei.com>
---
 drivers/i2c/busses/i2c-pxa.c |   13 ++++++++-----
 1 files changed, 8 insertions(+), 5 deletions(-)

diff --git a/drivers/i2c/busses/i2c-pxa.c b/drivers/i2c/busses/i2c-pxa.c
index ea6d45d..a9da954 100644
--- a/drivers/i2c/busses/i2c-pxa.c
+++ b/drivers/i2c/busses/i2c-pxa.c
@@ -1104,18 +1104,18 @@ static int i2c_pxa_probe(struct platform_device *dev)
 	if (ret > 0)
 		ret = i2c_pxa_probe_pdata(dev, i2c, &i2c_type);
 	if (ret < 0)
-		goto eclk;
+		goto edt;
 
 	res = platform_get_resource(dev, IORESOURCE_MEM, 0);
 	irq = platform_get_irq(dev, 0);
 	if (res == NULL || irq < 0) {
 		ret = -ENODEV;
-		goto eclk;
+		goto eirq;
 	}
 
 	if (!request_mem_region(res->start, resource_size(res), res->name)) {
 		ret = -ENOMEM;
-		goto eclk;
+		goto emem;
 	}
 
 	i2c->adap.owner   = THIS_MODULE;
@@ -1207,9 +1207,12 @@ ereqirq:
 eremap:
 	clk_put(i2c->clk);
 eclk:
-	kfree(i2c);
-emalloc:
 	release_mem_region(res->start, resource_size(res));
+emem:
+eirq:
+edt:
+	kfree(i2c);
+emalloc:	
 	return ret;
 }
 
-- 
1.7.1

^ permalink raw reply related	[flat|nested] 20+ messages in thread

* RE: [PATCH v2 1/2] i2c: i2c-bfin-twi: don`t free peripheral before it init successful
@ 2013-05-09  8:31     ` Zhang, Sonic
  0 siblings, 0 replies; 20+ messages in thread
From: Zhang, Sonic @ 2013-05-09  8:31 UTC (permalink / raw)
  To: Libo Chen, wsa; +Cc: uclinux-dist-devel, linux-kernel, linux-i2c, lizefan

Acked-by: Sonic Zhang <sonic.zhang@analog.com>

>-----Original Message-----
>From: Libo Chen [mailto:libo.chen@huawei.com]
>Sent: Thursday, May 09, 2013 4:27 PM
>To: Zhang, Sonic; wsa@the-dreams.de
>Cc: uclinux-dist-devel@blackfin.uclinux.org; linux-kernel@vger.kernel.org; linux-
>i2c@vger.kernel.org; lizefan@huawei.com; Libo Chen
>Subject: [PATCH v2 1/2] i2c: i2c-bfin-twi: don`t free peripheral before it init
>successful
>
>down out_error_no_irq. When platform_get_irq fail, no need to free peripheral
>
>Signed-off-by: Libo Chen <libo.chen@huawei.com>
>---
> drivers/i2c/busses/i2c-bfin-twi.c |    2 +-
> 1 files changed, 1 insertions(+), 1 deletions(-)
>
>diff --git a/drivers/i2c/busses/i2c-bfin-twi.c b/drivers/i2c/busses/i2c-bfin-twi.c
>index 05080c4..6617645 100644
>--- a/drivers/i2c/busses/i2c-bfin-twi.c
>+++ b/drivers/i2c/busses/i2c-bfin-twi.c
>@@ -709,9 +709,9 @@ static int i2c_bfin_twi_probe(struct platform_device *pdev)
> out_error_add_adapter:
>       free_irq(iface->irq, iface);
> out_error_req_irq:
>-out_error_no_irq:
>       peripheral_free_list((unsigned short *)pdev->dev.platform_data);
> out_error_pin_mux:
>+out_error_no_irq:
>       iounmap(iface->regs_base);
> out_error_ioremap:
> out_error_get_res:
>--
>1.7.1
>
>



^ permalink raw reply	[flat|nested] 20+ messages in thread

* RE: [PATCH v2 1/2] i2c: i2c-bfin-twi: don`t free peripheral before it init successful
@ 2013-05-09  8:31     ` Zhang, Sonic
  0 siblings, 0 replies; 20+ messages in thread
From: Zhang, Sonic @ 2013-05-09  8:31 UTC (permalink / raw)
  To: Libo Chen, wsa-z923LK4zBo2bacvFa/9K2g
  Cc: uclinux-dist-devel-ZG0+EudsQA8dtHy/vicBwGD2FQJk+8+b,
	linux-kernel-u79uwXL29TY76Z2rM5mHXA,
	linux-i2c-u79uwXL29TY76Z2rM5mHXA, lizefan-hv44wF8Li93QT0dZR+AlfA

Acked-by: Sonic Zhang <sonic.zhang-OyLXuOCK7orQT0dZR+AlfA@public.gmane.org>

>-----Original Message-----
>From: Libo Chen [mailto:libo.chen-hv44wF8Li93QT0dZR+AlfA@public.gmane.org]
>Sent: Thursday, May 09, 2013 4:27 PM
>To: Zhang, Sonic; wsa-z923LK4zBo2bacvFa/9K2g@public.gmane.org
>Cc: uclinux-dist-devel-ZG0+EudsQA8dtHy/vicBwGD2FQJk+8+b@public.gmane.org; linux-kernel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org; linux-
>i2c-u79uwXL29TY76Z2rM5mHXA@public.gmane.org; lizefan-hv44wF8Li93QT0dZR+AlfA@public.gmane.org; Libo Chen
>Subject: [PATCH v2 1/2] i2c: i2c-bfin-twi: don`t free peripheral before it init
>successful
>
>down out_error_no_irq. When platform_get_irq fail, no need to free peripheral
>
>Signed-off-by: Libo Chen <libo.chen-hv44wF8Li93QT0dZR+AlfA@public.gmane.org>
>---
> drivers/i2c/busses/i2c-bfin-twi.c |    2 +-
> 1 files changed, 1 insertions(+), 1 deletions(-)
>
>diff --git a/drivers/i2c/busses/i2c-bfin-twi.c b/drivers/i2c/busses/i2c-bfin-twi.c
>index 05080c4..6617645 100644
>--- a/drivers/i2c/busses/i2c-bfin-twi.c
>+++ b/drivers/i2c/busses/i2c-bfin-twi.c
>@@ -709,9 +709,9 @@ static int i2c_bfin_twi_probe(struct platform_device *pdev)
> out_error_add_adapter:
>       free_irq(iface->irq, iface);
> out_error_req_irq:
>-out_error_no_irq:
>       peripheral_free_list((unsigned short *)pdev->dev.platform_data);
> out_error_pin_mux:
>+out_error_no_irq:
>       iounmap(iface->regs_base);
> out_error_ioremap:
> out_error_get_res:
>--
>1.7.1
>
>

^ permalink raw reply	[flat|nested] 20+ messages in thread

* RE: [PATCH v2 1/2] i2c: i2c-bfin-twi: don`t free peripheral before it init successful
@ 2013-05-09  8:33     ` Zhang, Sonic
  0 siblings, 0 replies; 20+ messages in thread
From: Zhang, Sonic @ 2013-05-09  8:33 UTC (permalink / raw)
  To: Libo Chen, wsa; +Cc: uclinux-dist-devel, linux-kernel, linux-i2c, lizefan

Hi Libo,

>-----Original Message-----
>From: Libo Chen [mailto:libo.chen@huawei.com]
>Sent: Thursday, May 09, 2013 4:27 PM
>To: Zhang, Sonic; wsa@the-dreams.de
>Cc: uclinux-dist-devel@blackfin.uclinux.org; linux-kernel@vger.kernel.org; linux-
>i2c@vger.kernel.org; lizefan@huawei.com; Libo Chen
>Subject: [PATCH v2 1/2] i2c: i2c-bfin-twi: don`t free peripheral before it init
>successful
>
>down out_error_no_irq. When platform_get_irq fail, no need to free peripheral
>
>Signed-off-by: Libo Chen <libo.chen@huawei.com>
>---
> drivers/i2c/busses/i2c-bfin-twi.c |    2 +-
> 1 files changed, 1 insertions(+), 1 deletions(-)
>
>diff --git a/drivers/i2c/busses/i2c-bfin-twi.c b/drivers/i2c/busses/i2c-bfin-twi.c
>index 05080c4..6617645 100644
>--- a/drivers/i2c/busses/i2c-bfin-twi.c
>+++ b/drivers/i2c/busses/i2c-bfin-twi.c
>@@ -709,9 +709,9 @@ static int i2c_bfin_twi_probe(struct platform_device *pdev)
> out_error_add_adapter:
>       free_irq(iface->irq, iface);
> out_error_req_irq:
>-out_error_no_irq:
>       peripheral_free_list((unsigned short *)pdev->dev.platform_data);
> out_error_pin_mux:
>+out_error_no_irq:
>       iounmap(iface->regs_base);
> out_error_ioremap:
> out_error_get_res:
>--

Sorry, but you didn't exchange as I suggested.
Should be

> out_error_req_irq:
>-out_error_no_irq:
>+out_error_pin_mux:
>       peripheral_free_list((unsigned short *)pdev->dev.platform_data);
>-out_error_pin_mux:
>+out_error_no_irq:


Regards,

Sonic


^ permalink raw reply	[flat|nested] 20+ messages in thread

* RE: [PATCH v2 1/2] i2c: i2c-bfin-twi: don`t free peripheral before it init successful
@ 2013-05-09  8:33     ` Zhang, Sonic
  0 siblings, 0 replies; 20+ messages in thread
From: Zhang, Sonic @ 2013-05-09  8:33 UTC (permalink / raw)
  To: Libo Chen, wsa-z923LK4zBo2bacvFa/9K2g
  Cc: uclinux-dist-devel-ZG0+EudsQA8dtHy/vicBwGD2FQJk+8+b,
	linux-kernel-u79uwXL29TY76Z2rM5mHXA,
	linux-i2c-u79uwXL29TY76Z2rM5mHXA, lizefan-hv44wF8Li93QT0dZR+AlfA

Hi Libo,

>-----Original Message-----
>From: Libo Chen [mailto:libo.chen-hv44wF8Li93QT0dZR+AlfA@public.gmane.org]
>Sent: Thursday, May 09, 2013 4:27 PM
>To: Zhang, Sonic; wsa-z923LK4zBo2bacvFa/9K2g@public.gmane.org
>Cc: uclinux-dist-devel-ZG0+EudsQA8dtHy/vicBwGD2FQJk+8+b@public.gmane.org; linux-kernel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org; linux-
>i2c-u79uwXL29TY76Z2rM5mHXA@public.gmane.org; lizefan-hv44wF8Li93QT0dZR+AlfA@public.gmane.org; Libo Chen
>Subject: [PATCH v2 1/2] i2c: i2c-bfin-twi: don`t free peripheral before it init
>successful
>
>down out_error_no_irq. When platform_get_irq fail, no need to free peripheral
>
>Signed-off-by: Libo Chen <libo.chen-hv44wF8Li93QT0dZR+AlfA@public.gmane.org>
>---
> drivers/i2c/busses/i2c-bfin-twi.c |    2 +-
> 1 files changed, 1 insertions(+), 1 deletions(-)
>
>diff --git a/drivers/i2c/busses/i2c-bfin-twi.c b/drivers/i2c/busses/i2c-bfin-twi.c
>index 05080c4..6617645 100644
>--- a/drivers/i2c/busses/i2c-bfin-twi.c
>+++ b/drivers/i2c/busses/i2c-bfin-twi.c
>@@ -709,9 +709,9 @@ static int i2c_bfin_twi_probe(struct platform_device *pdev)
> out_error_add_adapter:
>       free_irq(iface->irq, iface);
> out_error_req_irq:
>-out_error_no_irq:
>       peripheral_free_list((unsigned short *)pdev->dev.platform_data);
> out_error_pin_mux:
>+out_error_no_irq:
>       iounmap(iface->regs_base);
> out_error_ioremap:
> out_error_get_res:
>--

Sorry, but you didn't exchange as I suggested.
Should be

> out_error_req_irq:
>-out_error_no_irq:
>+out_error_pin_mux:
>       peripheral_free_list((unsigned short *)pdev->dev.platform_data);
>-out_error_pin_mux:
>+out_error_no_irq:


Regards,

Sonic

^ permalink raw reply	[flat|nested] 20+ messages in thread

* RE: [PATCH v2 1/2] i2c: i2c-bfin-twi: don`t free peripheral before it init successful
  2013-05-09  8:27   ` Libo Chen
@ 2013-05-09  8:34     ` Zhang, Sonic
  -1 siblings, 0 replies; 20+ messages in thread
From: Zhang, Sonic @ 2013-05-09  8:34 UTC (permalink / raw)
  To: Zhang, Sonic, Libo Chen, wsa
  Cc: uclinux-dist-devel, linux-kernel, linux-i2c, lizefan

Please ignore my Ack.

Sonic

>-----Original Message-----
>From: Zhang, Sonic
>Sent: Thursday, May 09, 2013 4:31 PM
>To: 'Libo Chen'; wsa@the-dreams.de
>Cc: uclinux-dist-devel@blackfin.uclinux.org; linux-kernel@vger.kernel.org; linux-
>i2c@vger.kernel.org; lizefan@huawei.com
>Subject: RE: [PATCH v2 1/2] i2c: i2c-bfin-twi: don`t free peripheral before it init
>successful
>
>Acked-by: Sonic Zhang <sonic.zhang@analog.com>
>
>>-----Original Message-----
>>From: Libo Chen [mailto:libo.chen@huawei.com]
>>Sent: Thursday, May 09, 2013 4:27 PM
>>To: Zhang, Sonic; wsa@the-dreams.de
>>Cc: uclinux-dist-devel@blackfin.uclinux.org;
>>linux-kernel@vger.kernel.org; linux- i2c@vger.kernel.org;
>>lizefan@huawei.com; Libo Chen
>>Subject: [PATCH v2 1/2] i2c: i2c-bfin-twi: don`t free peripheral before
>>it init successful
>>
>>down out_error_no_irq. When platform_get_irq fail, no need to free
>>peripheral
>>
>>Signed-off-by: Libo Chen <libo.chen@huawei.com>
>>---
>> drivers/i2c/busses/i2c-bfin-twi.c |    2 +-
>> 1 files changed, 1 insertions(+), 1 deletions(-)
>>
>>diff --git a/drivers/i2c/busses/i2c-bfin-twi.c
>>b/drivers/i2c/busses/i2c-bfin-twi.c
>>index 05080c4..6617645 100644
>>--- a/drivers/i2c/busses/i2c-bfin-twi.c
>>+++ b/drivers/i2c/busses/i2c-bfin-twi.c
>>@@ -709,9 +709,9 @@ static int i2c_bfin_twi_probe(struct
>>platform_device *pdev)
>> out_error_add_adapter:
>>      free_irq(iface->irq, iface);
>> out_error_req_irq:
>>-out_error_no_irq:
>>      peripheral_free_list((unsigned short *)pdev->dev.platform_data);
>> out_error_pin_mux:
>>+out_error_no_irq:
>>      iounmap(iface->regs_base);
>> out_error_ioremap:
>> out_error_get_res:
>>--
>>1.7.1
>>
>>



^ permalink raw reply	[flat|nested] 20+ messages in thread

* RE: [PATCH v2 1/2] i2c: i2c-bfin-twi: don`t free peripheral before it init successful
@ 2013-05-09  8:34     ` Zhang, Sonic
  0 siblings, 0 replies; 20+ messages in thread
From: Zhang, Sonic @ 2013-05-09  8:34 UTC (permalink / raw)
  To: Zhang, Sonic, Libo Chen, wsa
  Cc: uclinux-dist-devel, linux-kernel, linux-i2c, lizefan

Please ignore my Ack.

Sonic

>-----Original Message-----
>From: Zhang, Sonic
>Sent: Thursday, May 09, 2013 4:31 PM
>To: 'Libo Chen'; wsa@the-dreams.de
>Cc: uclinux-dist-devel@blackfin.uclinux.org; linux-kernel@vger.kernel.org; linux-
>i2c@vger.kernel.org; lizefan@huawei.com
>Subject: RE: [PATCH v2 1/2] i2c: i2c-bfin-twi: don`t free peripheral before it init
>successful
>
>Acked-by: Sonic Zhang <sonic.zhang@analog.com>
>
>>-----Original Message-----
>>From: Libo Chen [mailto:libo.chen@huawei.com]
>>Sent: Thursday, May 09, 2013 4:27 PM
>>To: Zhang, Sonic; wsa@the-dreams.de
>>Cc: uclinux-dist-devel@blackfin.uclinux.org;
>>linux-kernel@vger.kernel.org; linux- i2c@vger.kernel.org;
>>lizefan@huawei.com; Libo Chen
>>Subject: [PATCH v2 1/2] i2c: i2c-bfin-twi: don`t free peripheral before
>>it init successful
>>
>>down out_error_no_irq. When platform_get_irq fail, no need to free
>>peripheral
>>
>>Signed-off-by: Libo Chen <libo.chen@huawei.com>
>>---
>> drivers/i2c/busses/i2c-bfin-twi.c |    2 +-
>> 1 files changed, 1 insertions(+), 1 deletions(-)
>>
>>diff --git a/drivers/i2c/busses/i2c-bfin-twi.c
>>b/drivers/i2c/busses/i2c-bfin-twi.c
>>index 05080c4..6617645 100644
>>--- a/drivers/i2c/busses/i2c-bfin-twi.c
>>+++ b/drivers/i2c/busses/i2c-bfin-twi.c
>>@@ -709,9 +709,9 @@ static int i2c_bfin_twi_probe(struct
>>platform_device *pdev)
>> out_error_add_adapter:
>>      free_irq(iface->irq, iface);
>> out_error_req_irq:
>>-out_error_no_irq:
>>      peripheral_free_list((unsigned short *)pdev->dev.platform_data);
>> out_error_pin_mux:
>>+out_error_no_irq:
>>      iounmap(iface->regs_base);
>> out_error_ioremap:
>> out_error_get_res:
>>--
>>1.7.1
>>
>>

^ permalink raw reply	[flat|nested] 20+ messages in thread

* Re: [PATCH v2 1/2] i2c: i2c-bfin-twi: don`t free peripheral before it init successful
@ 2013-05-10  1:01       ` Libo Chen
  0 siblings, 0 replies; 20+ messages in thread
From: Libo Chen @ 2013-05-10  1:01 UTC (permalink / raw)
  To: Zhang, Sonic
  Cc: Libo Chen, wsa, uclinux-dist-devel, linux-kernel, linux-i2c, lizefan

On 2013/5/9 16:33, Zhang, Sonic wrote:
> Hi Libo,
> 
>> -----Original Message-----
>> From: Libo Chen [mailto:libo.chen@huawei.com]
>> Sent: Thursday, May 09, 2013 4:27 PM
>> To: Zhang, Sonic; wsa@the-dreams.de
>> Cc: uclinux-dist-devel@blackfin.uclinux.org; linux-kernel@vger.kernel.org; linux-
>> i2c@vger.kernel.org; lizefan@huawei.com; Libo Chen
>> Subject: [PATCH v2 1/2] i2c: i2c-bfin-twi: don`t free peripheral before it init
>> successful
>>
>> down out_error_no_irq. When platform_get_irq fail, no need to free peripheral
>>
>> Signed-off-by: Libo Chen <libo.chen@huawei.com>
>> ---
>> drivers/i2c/busses/i2c-bfin-twi.c |    2 +-
>> 1 files changed, 1 insertions(+), 1 deletions(-)
>>
>> diff --git a/drivers/i2c/busses/i2c-bfin-twi.c b/drivers/i2c/busses/i2c-bfin-twi.c
>> index 05080c4..6617645 100644
>> --- a/drivers/i2c/busses/i2c-bfin-twi.c
>> +++ b/drivers/i2c/busses/i2c-bfin-twi.c
>> @@ -709,9 +709,9 @@ static int i2c_bfin_twi_probe(struct platform_device *pdev)
>> out_error_add_adapter:
>>       free_irq(iface->irq, iface);
>> out_error_req_irq:
>> -out_error_no_irq:
>>       peripheral_free_list((unsigned short *)pdev->dev.platform_data);
>> out_error_pin_mux:
>> +out_error_no_irq:
>>       iounmap(iface->regs_base);
>> out_error_ioremap:
>> out_error_get_res:
>> --
> 
> Sorry, but you didn't exchange as I suggested.
> Should be
> 

Hi Sonic,

Look at peripheral_request_list()
{
	u16 cnt;
	int ret;

	for (cnt = 0; per[cnt] != 0; cnt++) {

		ret = peripheral_request(per[cnt], label);

		if (ret < 0) {
			for ( ; cnt > 0; cnt--)
				peripheral_free(per[cnt - 1]);

			return ret;
		}
	}

	return 0;
}


When peripheral_request fail, it had called peripheral_free().
So there is no reason to call peripheral_free_list again.

Did I miss something else?


>> out_error_req_irq:
>> -out_error_no_irq:
>> +out_error_pin_mux:
>>       peripheral_free_list((unsigned short *)pdev->dev.platform_data);
>> -out_error_pin_mux:
>> +out_error_no_irq:
> 
> 
> Regards,
> 
> Sonic
> 
> 
> 



^ permalink raw reply	[flat|nested] 20+ messages in thread

* Re: [PATCH v2 1/2] i2c: i2c-bfin-twi: don`t free peripheral before it init successful
@ 2013-05-10  1:01       ` Libo Chen
  0 siblings, 0 replies; 20+ messages in thread
From: Libo Chen @ 2013-05-10  1:01 UTC (permalink / raw)
  To: Zhang, Sonic
  Cc: Libo Chen, wsa-z923LK4zBo2bacvFa/9K2g,
	uclinux-dist-devel-ZG0+EudsQA8dtHy/vicBwGD2FQJk+8+b,
	linux-kernel-u79uwXL29TY76Z2rM5mHXA,
	linux-i2c-u79uwXL29TY76Z2rM5mHXA, lizefan-hv44wF8Li93QT0dZR+AlfA

On 2013/5/9 16:33, Zhang, Sonic wrote:
> Hi Libo,
> 
>> -----Original Message-----
>> From: Libo Chen [mailto:libo.chen-hv44wF8Li93QT0dZR+AlfA@public.gmane.org]
>> Sent: Thursday, May 09, 2013 4:27 PM
>> To: Zhang, Sonic; wsa-z923LK4zBo2bacvFa/9K2g@public.gmane.org
>> Cc: uclinux-dist-devel-ZG0+EudsQA8dtHy/vicBwGD2FQJk+8+b@public.gmane.org; linux-kernel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org; linux-
>> i2c-u79uwXL29TY76Z2rM5mHXA@public.gmane.org; lizefan-hv44wF8Li93QT0dZR+AlfA@public.gmane.org; Libo Chen
>> Subject: [PATCH v2 1/2] i2c: i2c-bfin-twi: don`t free peripheral before it init
>> successful
>>
>> down out_error_no_irq. When platform_get_irq fail, no need to free peripheral
>>
>> Signed-off-by: Libo Chen <libo.chen-hv44wF8Li93QT0dZR+AlfA@public.gmane.org>
>> ---
>> drivers/i2c/busses/i2c-bfin-twi.c |    2 +-
>> 1 files changed, 1 insertions(+), 1 deletions(-)
>>
>> diff --git a/drivers/i2c/busses/i2c-bfin-twi.c b/drivers/i2c/busses/i2c-bfin-twi.c
>> index 05080c4..6617645 100644
>> --- a/drivers/i2c/busses/i2c-bfin-twi.c
>> +++ b/drivers/i2c/busses/i2c-bfin-twi.c
>> @@ -709,9 +709,9 @@ static int i2c_bfin_twi_probe(struct platform_device *pdev)
>> out_error_add_adapter:
>>       free_irq(iface->irq, iface);
>> out_error_req_irq:
>> -out_error_no_irq:
>>       peripheral_free_list((unsigned short *)pdev->dev.platform_data);
>> out_error_pin_mux:
>> +out_error_no_irq:
>>       iounmap(iface->regs_base);
>> out_error_ioremap:
>> out_error_get_res:
>> --
> 
> Sorry, but you didn't exchange as I suggested.
> Should be
> 

Hi Sonic,

Look at peripheral_request_list()
{
	u16 cnt;
	int ret;

	for (cnt = 0; per[cnt] != 0; cnt++) {

		ret = peripheral_request(per[cnt], label);

		if (ret < 0) {
			for ( ; cnt > 0; cnt--)
				peripheral_free(per[cnt - 1]);

			return ret;
		}
	}

	return 0;
}


When peripheral_request fail, it had called peripheral_free().
So there is no reason to call peripheral_free_list again.

Did I miss something else?


>> out_error_req_irq:
>> -out_error_no_irq:
>> +out_error_pin_mux:
>>       peripheral_free_list((unsigned short *)pdev->dev.platform_data);
>> -out_error_pin_mux:
>> +out_error_no_irq:
> 
> 
> Regards,
> 
> Sonic
> 
> 
> 

^ permalink raw reply	[flat|nested] 20+ messages in thread

* RE: [PATCH v2 1/2] i2c: i2c-bfin-twi: don`t free peripheral before it init successful
  2013-05-10  1:01       ` Libo Chen
@ 2013-05-13  8:52         ` Zhang, Sonic
  -1 siblings, 0 replies; 20+ messages in thread
From: Zhang, Sonic @ 2013-05-13  8:52 UTC (permalink / raw)
  To: Libo Chen
  Cc: Libo Chen, wsa, uclinux-dist-devel, linux-kernel, linux-i2c, lizefan

Hi Libo,

>-----Original Message-----
>From: Libo Chen [mailto:clbchenlibo.chen@huawei.com]
>Sent: Friday, May 10, 2013 9:02 AM
>To: Zhang, Sonic
>Cc: Libo Chen; wsa@the-dreams.de; uclinux-dist-devel@blackfin.uclinux.org;
>linux-kernel@vger.kernel.org; linux-i2c@vger.kernel.org; lizefan@huawei.com
>Subject: Re: [PATCH v2 1/2] i2c: i2c-bfin-twi: don`t free peripheral before it init
>successful
>
>On 2013/5/9 16:33, Zhang, Sonic wrote:
>> Hi Libo,
>>
>>> -----Original Message-----
>>> From: Libo Chen [mailto:libo.chen@huawei.com]
>>> Sent: Thursday, May 09, 2013 4:27 PM
>>> To: Zhang, Sonic; wsa@the-dreams.de
>>> Cc: uclinux-dist-devel@blackfin.uclinux.org;
>>> linux-kernel@vger.kernel.org; linux- i2c@vger.kernel.org;
>>> lizefan@huawei.com; Libo Chen
>>> Subject: [PATCH v2 1/2] i2c: i2c-bfin-twi: don`t free peripheral
>>> before it init successful
>>>
>>> down out_error_no_irq. When platform_get_irq fail, no need to free
>>> peripheral
>>>
>>> Signed-off-by: Libo Chen <libo.chen@huawei.com>
>>> ---
>>> drivers/i2c/busses/i2c-bfin-twi.c |    2 +-
>>> 1 files changed, 1 insertions(+), 1 deletions(-)
>>>
>>> diff --git a/drivers/i2c/busses/i2c-bfin-twi.c
>>> b/drivers/i2c/busses/i2c-bfin-twi.c
>>> index 05080c4..6617645 100644
>>> --- a/drivers/i2c/busses/i2c-bfin-twi.c
>>> +++ b/drivers/i2c/busses/i2c-bfin-twi.c
>>> @@ -709,9 +709,9 @@ static int i2c_bfin_twi_probe(struct
>>> platform_device *pdev)
>>> out_error_add_adapter:
>>>       free_irq(iface->irq, iface);
>>> out_error_req_irq:
>>> -out_error_no_irq:
>>>       peripheral_free_list((unsigned short
>>> *)pdev->dev.platform_data);
>>> out_error_pin_mux:
>>> +out_error_no_irq:
>>>       iounmap(iface->regs_base);
>>> out_error_ioremap:
>>> out_error_get_res:
>>> --
>>
>> Sorry, but you didn't exchange as I suggested.
>> Should be
>>
>
>Hi Sonic,
>
>Look at peripheral_request_list()
>{
>       u16 cnt;
>       int ret;
>
>       for (cnt = 0; per[cnt] != 0; cnt++) {
>
>               ret = peripheral_request(per[cnt], label);
>
>               if (ret < 0) {
>                       for ( ; cnt > 0; cnt--)
>                               peripheral_free(per[cnt - 1]);
>
>                       return ret;
>               }
>       }
>
>       return 0;
>}
>
>
>When peripheral_request fail, it had called peripheral_free().
>So there is no reason to call peripheral_free_list again.
>
>Did I miss something else?
>
>
Yes, you are right. They are freed in peripheral_request_list() if any one fails.

You have my ACK on this patch.

Regards,

Sonic



^ permalink raw reply	[flat|nested] 20+ messages in thread

* RE: [PATCH v2 1/2] i2c: i2c-bfin-twi: don`t free peripheral before it init successful
@ 2013-05-13  8:52         ` Zhang, Sonic
  0 siblings, 0 replies; 20+ messages in thread
From: Zhang, Sonic @ 2013-05-13  8:52 UTC (permalink / raw)
  To: Libo Chen
  Cc: Libo Chen, wsa, uclinux-dist-devel, linux-kernel, linux-i2c, lizefan

Hi Libo,

>-----Original Message-----
>From: Libo Chen [mailto:clbchenlibo.chen@huawei.com]
>Sent: Friday, May 10, 2013 9:02 AM
>To: Zhang, Sonic
>Cc: Libo Chen; wsa@the-dreams.de; uclinux-dist-devel@blackfin.uclinux.org;
>linux-kernel@vger.kernel.org; linux-i2c@vger.kernel.org; lizefan@huawei.com
>Subject: Re: [PATCH v2 1/2] i2c: i2c-bfin-twi: don`t free peripheral before it init
>successful
>
>On 2013/5/9 16:33, Zhang, Sonic wrote:
>> Hi Libo,
>>
>>> -----Original Message-----
>>> From: Libo Chen [mailto:libo.chen@huawei.com]
>>> Sent: Thursday, May 09, 2013 4:27 PM
>>> To: Zhang, Sonic; wsa@the-dreams.de
>>> Cc: uclinux-dist-devel@blackfin.uclinux.org;
>>> linux-kernel@vger.kernel.org; linux- i2c@vger.kernel.org;
>>> lizefan@huawei.com; Libo Chen
>>> Subject: [PATCH v2 1/2] i2c: i2c-bfin-twi: don`t free peripheral
>>> before it init successful
>>>
>>> down out_error_no_irq. When platform_get_irq fail, no need to free
>>> peripheral
>>>
>>> Signed-off-by: Libo Chen <libo.chen@huawei.com>
>>> ---
>>> drivers/i2c/busses/i2c-bfin-twi.c |    2 +-
>>> 1 files changed, 1 insertions(+), 1 deletions(-)
>>>
>>> diff --git a/drivers/i2c/busses/i2c-bfin-twi.c
>>> b/drivers/i2c/busses/i2c-bfin-twi.c
>>> index 05080c4..6617645 100644
>>> --- a/drivers/i2c/busses/i2c-bfin-twi.c
>>> +++ b/drivers/i2c/busses/i2c-bfin-twi.c
>>> @@ -709,9 +709,9 @@ static int i2c_bfin_twi_probe(struct
>>> platform_device *pdev)
>>> out_error_add_adapter:
>>>       free_irq(iface->irq, iface);
>>> out_error_req_irq:
>>> -out_error_no_irq:
>>>       peripheral_free_list((unsigned short
>>> *)pdev->dev.platform_data);
>>> out_error_pin_mux:
>>> +out_error_no_irq:
>>>       iounmap(iface->regs_base);
>>> out_error_ioremap:
>>> out_error_get_res:
>>> --
>>
>> Sorry, but you didn't exchange as I suggested.
>> Should be
>>
>
>Hi Sonic,
>
>Look at peripheral_request_list()
>{
>       u16 cnt;
>       int ret;
>
>       for (cnt = 0; per[cnt] != 0; cnt++) {
>
>               ret = peripheral_request(per[cnt], label);
>
>               if (ret < 0) {
>                       for ( ; cnt > 0; cnt--)
>                               peripheral_free(per[cnt - 1]);
>
>                       return ret;
>               }
>       }
>
>       return 0;
>}
>
>
>When peripheral_request fail, it had called peripheral_free().
>So there is no reason to call peripheral_free_list again.
>
>Did I miss something else?
>
>
Yes, you are right. They are freed in peripheral_request_list() if any one fails.

You have my ACK on this patch.

Regards,

Sonic

^ permalink raw reply	[flat|nested] 20+ messages in thread

* Re: [PATCH v2 0/2] i2c: fix two wrong mem release
@ 2013-05-17  9:43   ` Wolfram Sang
  0 siblings, 0 replies; 20+ messages in thread
From: Wolfram Sang @ 2013-05-17  9:43 UTC (permalink / raw)
  To: Libo Chen
  Cc: Sonic.Zhang, uclinux-dist-devel, linux-kernel, linux-i2c, lizefan

On Thu, May 09, 2013 at 04:27:22PM +0800, Libo Chen wrote:
> fix two wrong mem release
> 
> * Changelog from v1:
>   * exchange out_error_no_irq and out_error_pin_mux  suggested by Sonic <Sonic.Zhang@analog.com>  
>   * add some new tag , make code cleanly

Thanks for the submission. I do think the proper solution would be to
convert the drivers to use the devm_* mechanisms, though. You can check
commit 857968434bb6dbda0911f38ec46b0c3d0c963771 ("i2c: davinci: update
to devm_* API") as a reference.

Thanks,

   Wolfram

^ permalink raw reply	[flat|nested] 20+ messages in thread

* Re: [PATCH v2 0/2] i2c: fix two wrong mem release
@ 2013-05-17  9:43   ` Wolfram Sang
  0 siblings, 0 replies; 20+ messages in thread
From: Wolfram Sang @ 2013-05-17  9:43 UTC (permalink / raw)
  To: Libo Chen
  Cc: Sonic.Zhang-OyLXuOCK7orQT0dZR+AlfA,
	uclinux-dist-devel-ZG0+EudsQA8dtHy/vicBwGD2FQJk+8+b,
	linux-kernel-u79uwXL29TY76Z2rM5mHXA,
	linux-i2c-u79uwXL29TY76Z2rM5mHXA, lizefan-hv44wF8Li93QT0dZR+AlfA

On Thu, May 09, 2013 at 04:27:22PM +0800, Libo Chen wrote:
> fix two wrong mem release
> 
> * Changelog from v1:
>   * exchange out_error_no_irq and out_error_pin_mux  suggested by Sonic <Sonic.Zhang-OyLXuOCK7orQT0dZR+AlfA@public.gmane.org>  
>   * add some new tag , make code cleanly

Thanks for the submission. I do think the proper solution would be to
convert the drivers to use the devm_* mechanisms, though. You can check
commit 857968434bb6dbda0911f38ec46b0c3d0c963771 ("i2c: davinci: update
to devm_* API") as a reference.

Thanks,

   Wolfram

^ permalink raw reply	[flat|nested] 20+ messages in thread

* Re: [PATCH v2 0/2] i2c: fix two wrong mem release
  2013-05-17  9:43   ` Wolfram Sang
@ 2013-05-19  2:13     ` Libo Chen
  -1 siblings, 0 replies; 20+ messages in thread
From: Libo Chen @ 2013-05-19  2:13 UTC (permalink / raw)
  To: Wolfram Sang
  Cc: Libo Chen, Sonic.Zhang, uclinux-dist-devel, linux-kernel,
	linux-i2c, lizefan

于 2013-5-17 17:43, Wolfram Sang 写道:
> On Thu, May 09, 2013 at 04:27:22PM +0800, Libo Chen wrote:
>> >fix two wrong mem release
>> >
>> >* Changelog from v1:
>> >   * exchange out_error_no_irq and out_error_pin_mux  suggested by Sonic<Sonic.Zhang@analog.com>
>> >   * add some new tag , make code cleanly
> Thanks for the submission. I do think the proper solution would be to
> convert the drivers to use the devm_* mechanisms, though. You can check
> commit 857968434bb6dbda0911f38ec46b0c3d0c963771 ("i2c: davinci: update
> to devm_* API") as a reference.
>
> Thanks,
>
>     Wolfram

Hi, Wolfram

    It is a good idea. I will learn about it.

Thanks,
Libo

^ permalink raw reply	[flat|nested] 20+ messages in thread

* Re: [PATCH v2 0/2] i2c: fix two wrong mem release
@ 2013-05-19  2:13     ` Libo Chen
  0 siblings, 0 replies; 20+ messages in thread
From: Libo Chen @ 2013-05-19  2:13 UTC (permalink / raw)
  To: Wolfram Sang
  Cc: Libo Chen, Sonic.Zhang-OyLXuOCK7orQT0dZR+AlfA,
	uclinux-dist-devel-ZG0+EudsQA8dtHy/vicBwGD2FQJk+8+b,
	linux-kernel-u79uwXL29TY76Z2rM5mHXA,
	linux-i2c-u79uwXL29TY76Z2rM5mHXA, lizefan-hv44wF8Li93QT0dZR+AlfA

于 2013-5-17 17:43, Wolfram Sang 写道:
> On Thu, May 09, 2013 at 04:27:22PM +0800, Libo Chen wrote:
>> >fix two wrong mem release
>> >
>> >* Changelog from v1:
>> >   * exchange out_error_no_irq and out_error_pin_mux  suggested by Sonic<Sonic.Zhang-OyLXuOCK7orQT0dZR+AlfA@public.gmane.org>
>> >   * add some new tag , make code cleanly
> Thanks for the submission. I do think the proper solution would be to
> convert the drivers to use the devm_* mechanisms, though. You can check
> commit 857968434bb6dbda0911f38ec46b0c3d0c963771 ("i2c: davinci: update
> to devm_* API") as a reference.
>
> Thanks,
>
>     Wolfram

Hi, Wolfram

    It is a good idea. I will learn about it.

Thanks,
Libo

^ permalink raw reply	[flat|nested] 20+ messages in thread

end of thread, other threads:[~2013-05-19  2:13 UTC | newest]

Thread overview: 20+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-05-09  8:27 [PATCH v2 0/2] i2c: fix two wrong mem release Libo Chen
2013-05-09  8:27 ` Libo Chen
2013-05-09  8:27 ` [PATCH v2 1/2] i2c: i2c-bfin-twi: don`t free peripheral before it init successful Libo Chen
2013-05-09  8:27   ` Libo Chen
2013-05-09  8:31   ` Zhang, Sonic
2013-05-09  8:31     ` Zhang, Sonic
2013-05-09  8:33   ` Zhang, Sonic
2013-05-09  8:33     ` Zhang, Sonic
2013-05-10  1:01     ` Libo Chen
2013-05-10  1:01       ` Libo Chen
2013-05-13  8:52       ` Zhang, Sonic
2013-05-13  8:52         ` Zhang, Sonic
2013-05-09  8:34   ` Zhang, Sonic
2013-05-09  8:34     ` Zhang, Sonic
2013-05-09  8:27 ` [PATCH v2 2/2] i2c: pxa: no need release_mem_region before request_mem_region successful Libo Chen
2013-05-09  8:27   ` Libo Chen
2013-05-17  9:43 ` [PATCH v2 0/2] i2c: fix two wrong mem release Wolfram Sang
2013-05-17  9:43   ` Wolfram Sang
2013-05-19  2:13   ` Libo Chen
2013-05-19  2:13     ` Libo Chen

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.