Re: [PATCH 0/8] sa11x0 PCMCIA updates

2015-03-26 Thread Robert Jarzmik
Russell King - ARM Linux  writes:

> I will be testing the sa11x0 changes later today, but as I gave most
> of my PXA2xx platforms to Robert, I need Robert to test this on the
> Lubbock.
I will be done this weekend Russell.

Cheers.

-- 
Robert

___
Linux PCMCIA reimplementation list
http://lists.infradead.org/mailman/listinfo/linux-pcmcia


Re: [PATCHv2] pcmcia:Fix memory leak in the function, sa11xx_drv_pcmcia_probe

2015-03-26 Thread Larry Finger

On 03/26/2015 10:08 AM, Nicholas Krause wrote:



I looked through the clk Api and this seems the simplest way to do it.  Can you 
send me your solution as I  am curious how yours is better than  mine.  
Furthermore I  have finally come to the conclusion that my research efforts 
need to improve and will look into improving them. Also it would be great if 
you can put reported by me on the patches in your series fixing this issue.


http://marc.info/?l=linux-pcmcia&m=142736903012616&w=2 and following patches.

Read and learn,

Larry




___
Linux PCMCIA reimplementation list
http://lists.infradead.org/mailman/listinfo/linux-pcmcia


Re: [PATCHv2] pcmcia:Fix memory leak in the function, sa11xx_drv_pcmcia_probe

2015-03-26 Thread Nicholas Krause


On March 26, 2015 11:42:22 AM EDT, Larry Finger  
wrote:
>On 03/26/2015 10:08 AM, Nicholas Krause wrote:
>
>
>> I looked through the clk Api and this seems the simplest way to do
>it.  Can you send me your solution as I  am curious how yours is better
>than  mine.  Furthermore I  have finally come to the conclusion that my
>research efforts need to improve and will look into improving them.
>Also it would be great if you can put reported by me on the patches in
>your series fixing this issue.
>
>http://marc.info/?l=linux-pcmcia&m=142736903012616&w=2 and following
>patches.
>
>Read and learn,
>
>Larry
Thanks Larry, 
This is very helpful. 
Nick 

-- 
Sent from my Android device with K-9 Mail. Please excuse my brevity.

___
Linux PCMCIA reimplementation list
http://lists.infradead.org/mailman/listinfo/linux-pcmcia


Re: [PATCHv2] pcmcia:Fix memory leak in the function, sa11xx_drv_pcmcia_probe

2015-03-26 Thread Nicholas Krause


On March 26, 2015 7:26:04 AM EDT, Russell King - ARM Linux 
 wrote:
>On Thu, Mar 26, 2015 at 07:14:38AM -0400, Nicholas Krause wrote:
>> 
>> 
>> On March 26, 2015 5:52:25 AM EDT, Russell King - ARM Linux
> wrote:
>> >On Wed, Mar 25, 2015 at 11:15:52PM -0400, Nicholas Krause wrote:
>> >> This fixes the memory found when running  coccinelle on the latest
>> >
>> >How does this "fix the memory" ?  Is the memory faulty?
>> >
>> >> kernel tree for if we are unable to successfully allocate memory
>> >> for the structure pointer,sinfo of type skt_dev_info and need to
>> >> clean up the memory already allocated to the clk structure
>pointer,
>> >> clk by calling clk_get on it and freeing the no longer required
>> >> mermory for this structure pointer.
>> >
>> >This makes no sense.  clk_get() itself doesn't allocate any memory. 
>As
>> >usual, you act as a mechanical automatom which doesn't understand
>what
>> >you're doing or you just guess.  I don't care which it is, you are a
>> >danger to the kernel by doing this.  As many other experienced
>kernel
>> >developers have told you, please stop.
>> >
>> >In any case, I'm NAKing your patch as there's better ways to solve
>> >this.
>> >That's where experience and research come in.
>> >
>> >Nevertheless, thanks for pointing out the oversight, and I notice
>that
>> >there are a few more cases too.
>> Very well then I  guess my patch commit message was wrong. 
>
>Again, you fail to understand what you are being told.  Please re-read
>the paragraph which starts "In any case, I'm NAKing your patch".
>
>Your patch is one way to solve it, but there are other solutions too.
>I've just posted a small patch series which addresses the issue you
>have raised.  You need to perform no further action on this.
I looked through the clk Api and this seems the simplest way to do it.  Can you 
send me your solution as I  am curious how yours is better than  mine.  
Furthermore I  have finally come to the conclusion that my research efforts 
need to improve and will look into improving them. Also it would be great if 
you can put reported by me on the patches in your series fixing this issue.
Thanks, 
Nick 
-- 
Sent from my Android device with K-9 Mail. Please excuse my brevity.

___
Linux PCMCIA reimplementation list
http://lists.infradead.org/mailman/listinfo/linux-pcmcia


Re: [PATCHv2] pcmcia:Fix memory leak in the function, sa11xx_drv_pcmcia_probe

2015-03-26 Thread Nicholas Krause


On March 26, 2015 7:26:04 AM EDT, Russell King - ARM Linux 
 wrote:
>On Thu, Mar 26, 2015 at 07:14:38AM -0400, Nicholas Krause wrote:
>> 
>> 
>> On March 26, 2015 5:52:25 AM EDT, Russell King - ARM Linux
> wrote:
>> >On Wed, Mar 25, 2015 at 11:15:52PM -0400, Nicholas Krause wrote:
>> >> This fixes the memory found when running  coccinelle on the latest
>> >
>> >How does this "fix the memory" ?  Is the memory faulty?
>> >
>> >> kernel tree for if we are unable to successfully allocate memory
>> >> for the structure pointer,sinfo of type skt_dev_info and need to
>> >> clean up the memory already allocated to the clk structure
>pointer,
>> >> clk by calling clk_get on it and freeing the no longer required
>> >> mermory for this structure pointer.
>> >
>> >This makes no sense.  clk_get() itself doesn't allocate any memory. 
>As
>> >usual, you act as a mechanical automatom which doesn't understand
>what
>> >you're doing or you just guess.  I don't care which it is, you are a
>> >danger to the kernel by doing this.  As many other experienced
>kernel
>> >developers have told you, please stop.
>> >
>> >In any case, I'm NAKing your patch as there's better ways to solve
>> >this.
>> >That's where experience and research come in.
>> >
>> >Nevertheless, thanks for pointing out the oversight, and I notice
>that
>> >there are a few more cases too.
>> Very well then I  guess my patch commit message was wrong. 
>
>Again, you fail to understand what you are being told.  Please re-read
>the paragraph which starts "In any case, I'm NAKing your patch".
>
>Your patch is one way to solve it, but there are other solutions too.
>I've just posted a small patch series which addresses the issue you
>have raised.  You need to perform no further action on this.
That's fine, however I would like to see your solution for my own learning.  
Furthermore I did look into it further and clk put is a wrapper function that 
calls __clk_up which does kfree our structure pointer and releases other 
resources allocated to  it, namely deleting it from the hlist and removing one  
from it's ref count with a call to __clk_release. 
Nick

-- 
Sent from my Android device with K-9 Mail. Please excuse my brevity.

___
Linux PCMCIA reimplementation list
http://lists.infradead.org/mailman/listinfo/linux-pcmcia


Re: [PATCHv2] pcmcia:Fix memory leak in the function, sa11xx_drv_pcmcia_probe

2015-03-26 Thread Russell King - ARM Linux
On Thu, Mar 26, 2015 at 07:14:38AM -0400, Nicholas Krause wrote:
> 
> 
> On March 26, 2015 5:52:25 AM EDT, Russell King - ARM Linux 
>  wrote:
> >On Wed, Mar 25, 2015 at 11:15:52PM -0400, Nicholas Krause wrote:
> >> This fixes the memory found when running  coccinelle on the latest
> >
> >How does this "fix the memory" ?  Is the memory faulty?
> >
> >> kernel tree for if we are unable to successfully allocate memory
> >> for the structure pointer,sinfo of type skt_dev_info and need to
> >> clean up the memory already allocated to the clk structure pointer,
> >> clk by calling clk_get on it and freeing the no longer required
> >> mermory for this structure pointer.
> >
> >This makes no sense.  clk_get() itself doesn't allocate any memory.  As
> >usual, you act as a mechanical automatom which doesn't understand what
> >you're doing or you just guess.  I don't care which it is, you are a
> >danger to the kernel by doing this.  As many other experienced kernel
> >developers have told you, please stop.
> >
> >In any case, I'm NAKing your patch as there's better ways to solve
> >this.
> >That's where experience and research come in.
> >
> >Nevertheless, thanks for pointing out the oversight, and I notice that
> >there are a few more cases too.
> Very well then I  guess my patch commit message was wrong. 

Again, you fail to understand what you are being told.  Please re-read
the paragraph which starts "In any case, I'm NAKing your patch".

Your patch is one way to solve it, but there are other solutions too.
I've just posted a small patch series which addresses the issue you
have raised.  You need to perform no further action on this.

-- 
FTTC broadband for 0.8mile line: currently at 10.5Mbps down 400kbps up
according to speedtest.net.

___
Linux PCMCIA reimplementation list
http://lists.infradead.org/mailman/listinfo/linux-pcmcia


[PATCH 8/8] pcmcia: soc_common: remove skt_dev_info's clk pointer

2015-03-26 Thread Russell King
We no longer need to store the clk pointer in struct skt_dev_info as we
no longer need to remember the clk pointer for the cleanup paths.

Signed-off-by: Russell King 
---
 drivers/pcmcia/pxa2xx_base.c | 1 -
 drivers/pcmcia/sa11xx_base.c | 1 -
 drivers/pcmcia/soc_common.h  | 1 -
 3 files changed, 3 deletions(-)

diff --git a/drivers/pcmcia/pxa2xx_base.c b/drivers/pcmcia/pxa2xx_base.c
index dfcf07828605..1b2c58dd43cf 100644
--- a/drivers/pcmcia/pxa2xx_base.c
+++ b/drivers/pcmcia/pxa2xx_base.c
@@ -308,7 +308,6 @@ static int pxa2xx_drv_pcmcia_probe(struct platform_device 
*dev)
return -ENOMEM;
 
sinfo->nskt = ops->nr;
-   sinfo->clk = clk;
 
/* Initialize processor specific parameters */
for (i = 0; i < ops->nr; i++) {
diff --git a/drivers/pcmcia/sa11xx_base.c b/drivers/pcmcia/sa11xx_base.c
index 815b6950975c..9f6ec87b9f9e 100644
--- a/drivers/pcmcia/sa11xx_base.c
+++ b/drivers/pcmcia/sa11xx_base.c
@@ -233,7 +233,6 @@ int sa11xx_drv_pcmcia_probe(struct device *dev, struct 
pcmcia_low_level *ops,
return -ENOMEM;
 
sinfo->nskt = nr;
-   sinfo->clk = clk;
 
/* Initialize processor specific parameters */
for (i = 0; i < nr; i++) {
diff --git a/drivers/pcmcia/soc_common.h b/drivers/pcmcia/soc_common.h
index e6fcbea5b682..94762a54d731 100644
--- a/drivers/pcmcia/soc_common.h
+++ b/drivers/pcmcia/soc_common.h
@@ -68,7 +68,6 @@ struct soc_pcmcia_socket {
 
 struct skt_dev_info {
int nskt;
-   struct clk *clk;
struct soc_pcmcia_socket skt[0];
 };
 
-- 
1.8.3.1


___
Linux PCMCIA reimplementation list
http://lists.infradead.org/mailman/listinfo/linux-pcmcia


[PATCH 7/8] pcmcia: sa11xx_base.c: remove useless init/exit functions

2015-03-26 Thread Russell King
A library module is not required to have module init/exit functions.
Get rid of these unnecessary functions.

Signed-off-by: Russell King 
---
 drivers/pcmcia/sa11xx_base.c | 10 --
 1 file changed, 10 deletions(-)

diff --git a/drivers/pcmcia/sa11xx_base.c b/drivers/pcmcia/sa11xx_base.c
index 6e6336d47d4a..815b6950975c 100644
--- a/drivers/pcmcia/sa11xx_base.c
+++ b/drivers/pcmcia/sa11xx_base.c
@@ -259,16 +259,6 @@ int sa11xx_drv_pcmcia_probe(struct device *dev, struct 
pcmcia_low_level *ops,
 }
 EXPORT_SYMBOL(sa11xx_drv_pcmcia_probe);
 
-static int __init sa11xx_pcmcia_init(void)
-{
-   return 0;
-}
-fs_initcall(sa11xx_pcmcia_init);
-
-static void __exit sa11xx_pcmcia_exit(void) {}
-
-module_exit(sa11xx_pcmcia_exit);
-
 MODULE_AUTHOR("John Dorsey ");
 MODULE_DESCRIPTION("Linux PCMCIA Card Services: SA-11xx core socket driver");
 MODULE_LICENSE("Dual MPL/GPL");
-- 
1.8.3.1


___
Linux PCMCIA reimplementation list
http://lists.infradead.org/mailman/listinfo/linux-pcmcia


[PATCH 6/8] pcmcia: sa1111: simplify clk handing in sa1111_pcmcia_add()

2015-03-26 Thread Russell King
clk_get(dev, NULL) will always refer to the same clock, so it's
pointless calling this multiple times for the same device.  As we no
longer have to worry about the cleanup (via use of devm_clk_get()) we
can simplify sa_pcmcia_add() too.

Signed-off-by: Russell King 
---
 drivers/pcmcia/sa_generic.c | 13 +++--
 1 file changed, 7 insertions(+), 6 deletions(-)

diff --git a/drivers/pcmcia/sa_generic.c b/drivers/pcmcia/sa_generic.c
index fb902af8a5b7..a1531feb8460 100644
--- a/drivers/pcmcia/sa_generic.c
+++ b/drivers/pcmcia/sa_generic.c
@@ -135,8 +135,13 @@ int sa_pcmcia_add(struct sa_dev *dev, struct 
pcmcia_low_level *ops,
int (*add)(struct soc_pcmcia_socket *))
 {
struct sa_pcmcia_socket *s;
+   struct clk *clk;
int i, ret = 0;
 
+   clk = devm_clk_get(&dev->dev, NULL);
+   if (IS_ERR(clk))
+   return PTR_ERR(clk);
+
ops->socket_state = sa_pcmcia_socket_state;
 
for (i = 0; i < ops->nr; i++) {
@@ -145,12 +150,8 @@ int sa_pcmcia_add(struct sa_dev *dev, struct 
pcmcia_low_level *ops,
return -ENOMEM;
 
s->soc.nr = ops->first + i;
-   s->soc.clk = devm_clk_get(&dev->dev, NULL);
-   if (IS_ERR(s->soc.clk)) {
-   ret = PTR_ERR(s->soc.clk);
-   kfree(s);
-   return ret;
-   }
+   s->soc.clk = clk;
+
soc_pcmcia_init_one(&s->soc, ops, &dev->dev);
s->dev = dev;
if (s->soc.nr) {
-- 
1.8.3.1


___
Linux PCMCIA reimplementation list
http://lists.infradead.org/mailman/listinfo/linux-pcmcia


[PATCH 5/8] pcmcia: sa1111: update socket driver to use devm_clk_get() API

2015-03-26 Thread Russell King
Update the pxa2xx socket driver to use the devm_clk_get() API so that
the cleanup paths are simplified.

Signed-off-by: Russell King 
---
 drivers/pcmcia/sa_generic.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/drivers/pcmcia/sa_generic.c b/drivers/pcmcia/sa_generic.c
index 80b8e9d05275..fb902af8a5b7 100644
--- a/drivers/pcmcia/sa_generic.c
+++ b/drivers/pcmcia/sa_generic.c
@@ -145,7 +145,7 @@ int sa_pcmcia_add(struct sa_dev *dev, struct 
pcmcia_low_level *ops,
return -ENOMEM;
 
s->soc.nr = ops->first + i;
-   s->soc.clk = clk_get(&dev->dev, NULL);
+   s->soc.clk = devm_clk_get(&dev->dev, NULL);
if (IS_ERR(s->soc.clk)) {
ret = PTR_ERR(s->soc.clk);
kfree(s);
@@ -226,7 +226,6 @@ static int pcmcia_remove(struct sa_dev *dev)
for (; s; s = next) {
next = s->next;
soc_pcmcia_remove_one(&s->soc);
-   clk_put(s->soc.clk);
kfree(s);
}
 
-- 
1.8.3.1


___
Linux PCMCIA reimplementation list
http://lists.infradead.org/mailman/listinfo/linux-pcmcia


[PATCH 3/8] pcmcia: pxa2xx: update socket driver to use devm_clk_get() API

2015-03-26 Thread Russell King
Update the pxa2xx socket driver to use the devm_clk_get() API so that
the cleanup paths are simplified.

Signed-off-by: Russell King 
---
 drivers/pcmcia/pxa2xx_base.c | 8 ++--
 1 file changed, 2 insertions(+), 6 deletions(-)

diff --git a/drivers/pcmcia/pxa2xx_base.c b/drivers/pcmcia/pxa2xx_base.c
index 984a8ff559d8..197c77a64ce0 100644
--- a/drivers/pcmcia/pxa2xx_base.c
+++ b/drivers/pcmcia/pxa2xx_base.c
@@ -296,17 +296,15 @@ static int pxa2xx_drv_pcmcia_probe(struct platform_device 
*dev)
goto err0;
}
 
-   clk = clk_get(&dev->dev, NULL);
+   clk = devm_clk_get(&dev->dev, NULL);
if (IS_ERR(clk))
return -ENODEV;
 
pxa2xx_drv_pcmcia_ops(ops);
 
sinfo = kzalloc(SKT_DEV_INFO_SIZE(ops->nr), GFP_KERNEL);
-   if (!sinfo) {
-   clk_put(clk);
+   if (!sinfo)
return -ENOMEM;
-   }
 
sinfo->nskt = ops->nr;
sinfo->clk = clk;
@@ -332,7 +330,6 @@ static int pxa2xx_drv_pcmcia_probe(struct platform_device 
*dev)
 err1:
while (--i >= 0)
soc_pcmcia_remove_one(&sinfo->skt[i]);
-   clk_put(clk);
kfree(sinfo);
 err0:
return ret;
@@ -348,7 +345,6 @@ static int pxa2xx_drv_pcmcia_remove(struct platform_device 
*dev)
for (i = 0; i < sinfo->nskt; i++)
soc_pcmcia_remove_one(&sinfo->skt[i]);
 
-   clk_put(sinfo->clk);
kfree(sinfo);
return 0;
 }
-- 
1.8.3.1


___
Linux PCMCIA reimplementation list
http://lists.infradead.org/mailman/listinfo/linux-pcmcia


[PATCH 4/8] pcmcia: pxa2xx: convert memory allocation to devm_* API

2015-03-26 Thread Russell King
Convert the pxa2xx socket driver memory allocation to use devm_kzalloc()
to simplify the cleanup path.

Signed-off-by: Russell King 
---
 drivers/pcmcia/pxa2xx_base.c | 8 +++-
 1 file changed, 3 insertions(+), 5 deletions(-)

diff --git a/drivers/pcmcia/pxa2xx_base.c b/drivers/pcmcia/pxa2xx_base.c
index 197c77a64ce0..dfcf07828605 100644
--- a/drivers/pcmcia/pxa2xx_base.c
+++ b/drivers/pcmcia/pxa2xx_base.c
@@ -302,7 +302,8 @@ static int pxa2xx_drv_pcmcia_probe(struct platform_device 
*dev)
 
pxa2xx_drv_pcmcia_ops(ops);
 
-   sinfo = kzalloc(SKT_DEV_INFO_SIZE(ops->nr), GFP_KERNEL);
+   sinfo = devm_kzalloc(&pdev->dev, SKT_DEV_INFO_SIZE(ops->nr),
+GFP_KERNEL);
if (!sinfo)
return -ENOMEM;
 
@@ -330,7 +331,7 @@ static int pxa2xx_drv_pcmcia_probe(struct platform_device 
*dev)
 err1:
while (--i >= 0)
soc_pcmcia_remove_one(&sinfo->skt[i]);
-   kfree(sinfo);
+
 err0:
return ret;
 }
@@ -340,12 +341,9 @@ static int pxa2xx_drv_pcmcia_remove(struct platform_device 
*dev)
struct skt_dev_info *sinfo = platform_get_drvdata(dev);
int i;
 
-   platform_set_drvdata(dev, NULL);
-
for (i = 0; i < sinfo->nskt; i++)
soc_pcmcia_remove_one(&sinfo->skt[i]);
 
-   kfree(sinfo);
return 0;
 }
 
-- 
1.8.3.1


___
Linux PCMCIA reimplementation list
http://lists.infradead.org/mailman/listinfo/linux-pcmcia


[PATCH 2/8] pcmcia: sa11x0: convert memory allocation to devm_* API

2015-03-26 Thread Russell King
Convert the sa11x0 socket driver memory allocation to use devm_kzalloc()
to simplify the cleanup path.

Signed-off-by: Russell King 
---
 drivers/pcmcia/sa1100_generic.c | 1 -
 drivers/pcmcia/sa11xx_base.c| 3 +--
 2 files changed, 1 insertion(+), 3 deletions(-)

diff --git a/drivers/pcmcia/sa1100_generic.c b/drivers/pcmcia/sa1100_generic.c
index 42861cc70158..66acdc85727c 100644
--- a/drivers/pcmcia/sa1100_generic.c
+++ b/drivers/pcmcia/sa1100_generic.c
@@ -93,7 +93,6 @@ static int sa11x0_drv_pcmcia_remove(struct platform_device 
*dev)
for (i = 0; i < sinfo->nskt; i++)
soc_pcmcia_remove_one(&sinfo->skt[i]);
 
-   kfree(sinfo);
return 0;
 }
 
diff --git a/drivers/pcmcia/sa11xx_base.c b/drivers/pcmcia/sa11xx_base.c
index 553d70a67f80..6e6336d47d4a 100644
--- a/drivers/pcmcia/sa11xx_base.c
+++ b/drivers/pcmcia/sa11xx_base.c
@@ -228,7 +228,7 @@ int sa11xx_drv_pcmcia_probe(struct device *dev, struct 
pcmcia_low_level *ops,
 
sa11xx_drv_pcmcia_ops(ops);
 
-   sinfo = kzalloc(SKT_DEV_INFO_SIZE(nr), GFP_KERNEL);
+   sinfo = devm_kzalloc(dev, SKT_DEV_INFO_SIZE(nr), GFP_KERNEL);
if (!sinfo)
return -ENOMEM;
 
@@ -251,7 +251,6 @@ int sa11xx_drv_pcmcia_probe(struct device *dev, struct 
pcmcia_low_level *ops,
if (ret) {
while (--i >= 0)
soc_pcmcia_remove_one(&sinfo->skt[i]);
-   kfree(sinfo);
} else {
dev_set_drvdata(dev, sinfo);
}
-- 
1.8.3.1


___
Linux PCMCIA reimplementation list
http://lists.infradead.org/mailman/listinfo/linux-pcmcia


[PATCH 1/8] pcmcia: sa11x0: fix missing clk_put() in sa11x0 socket drivers

2015-03-26 Thread Russell King
Fix the lack of clk_put() in sa11xx_base.c's error cleanup paths by
converting the driver to the devm_* API.

Fixes: 86d88bfca475 ("ARM: 8247/2: pcmcia: sa1100: make use of device clock")
Signed-off-by: Russell King 
---
 drivers/pcmcia/sa1100_generic.c | 1 -
 drivers/pcmcia/sa11xx_base.c| 3 +--
 2 files changed, 1 insertion(+), 3 deletions(-)

diff --git a/drivers/pcmcia/sa1100_generic.c b/drivers/pcmcia/sa1100_generic.c
index 803945259da8..42861cc70158 100644
--- a/drivers/pcmcia/sa1100_generic.c
+++ b/drivers/pcmcia/sa1100_generic.c
@@ -93,7 +93,6 @@ static int sa11x0_drv_pcmcia_remove(struct platform_device 
*dev)
for (i = 0; i < sinfo->nskt; i++)
soc_pcmcia_remove_one(&sinfo->skt[i]);
 
-   clk_put(sinfo->clk);
kfree(sinfo);
return 0;
 }
diff --git a/drivers/pcmcia/sa11xx_base.c b/drivers/pcmcia/sa11xx_base.c
index cf6de2c2b329..553d70a67f80 100644
--- a/drivers/pcmcia/sa11xx_base.c
+++ b/drivers/pcmcia/sa11xx_base.c
@@ -222,7 +222,7 @@ int sa11xx_drv_pcmcia_probe(struct device *dev, struct 
pcmcia_low_level *ops,
int i, ret = 0;
struct clk *clk;
 
-   clk = clk_get(dev, NULL);
+   clk = devm_clk_get(dev, NULL);
if (IS_ERR(clk))
return PTR_ERR(clk);
 
@@ -251,7 +251,6 @@ int sa11xx_drv_pcmcia_probe(struct device *dev, struct 
pcmcia_low_level *ops,
if (ret) {
while (--i >= 0)
soc_pcmcia_remove_one(&sinfo->skt[i]);
-   clk_put(clk);
kfree(sinfo);
} else {
dev_set_drvdata(dev, sinfo);
-- 
1.8.3.1


___
Linux PCMCIA reimplementation list
http://lists.infradead.org/mailman/listinfo/linux-pcmcia


[PATCH 0/8] sa11x0 PCMCIA updates

2015-03-26 Thread Russell King - ARM Linux
Here's a collection of patches which cleans up and updates the SA11x0
and PXA2xx socket drivers, particularly converting them to the devm_*
APIs to ensure that resources are properly cleaned up.

I've stopped short of totally converting sa_generic as there are
some corner cases where we want to initialise only socket 1, but not
socket 0, which would require further testing to ensure that these
changes are correct.

I will be testing the sa11x0 changes later today, but as I gave most
of my PXA2xx platforms to Robert, I need Robert to test this on the
Lubbock.

 drivers/pcmcia/pxa2xx_base.c| 17 +
 drivers/pcmcia/sa1100_generic.c |  2 --
 drivers/pcmcia/sa_generic.c | 14 +++---
 drivers/pcmcia/sa11xx_base.c| 17 ++---
 drivers/pcmcia/soc_common.h |  1 -
 5 files changed, 14 insertions(+), 37 deletions(-)

-- 
FTTC broadband for 0.8mile line: currently at 10.5Mbps down 400kbps up
according to speedtest.net.

___
Linux PCMCIA reimplementation list
http://lists.infradead.org/mailman/listinfo/linux-pcmcia


Re: [PATCHv2] pcmcia:Fix memory leak in the function, sa11xx_drv_pcmcia_probe

2015-03-26 Thread Nicholas Krause


On March 26, 2015 5:52:25 AM EDT, Russell King - ARM Linux 
 wrote:
>On Wed, Mar 25, 2015 at 11:15:52PM -0400, Nicholas Krause wrote:
>> This fixes the memory found when running  coccinelle on the latest
>
>How does this "fix the memory" ?  Is the memory faulty?
>
>> kernel tree for if we are unable to successfully allocate memory
>> for the structure pointer,sinfo of type skt_dev_info and need to
>> clean up the memory already allocated to the clk structure pointer,
>> clk by calling clk_get on it and freeing the no longer required
>> mermory for this structure pointer.
>
>This makes no sense.  clk_get() itself doesn't allocate any memory.  As
>usual, you act as a mechanical automatom which doesn't understand what
>you're doing or you just guess.  I don't care which it is, you are a
>danger to the kernel by doing this.  As many other experienced kernel
>developers have told you, please stop.
>
>In any case, I'm NAKing your patch as there's better ways to solve
>this.
>That's where experience and research come in.
>
>Nevertheless, thanks for pointing out the oversight, and I notice that
>there are a few more cases too.
Very well then I  guess my patch commit message was wrong. 
Nick

-- 
Sent from my Android device with K-9 Mail. Please excuse my brevity.

___
Linux PCMCIA reimplementation list
http://lists.infradead.org/mailman/listinfo/linux-pcmcia


Re: [PATCHv2] pcmcia:Fix memory leak in the function, sa11xx_drv_pcmcia_probe

2015-03-26 Thread Russell King - ARM Linux
On Wed, Mar 25, 2015 at 11:15:52PM -0400, Nicholas Krause wrote:
> This fixes the memory found when running  coccinelle on the latest

How does this "fix the memory" ?  Is the memory faulty?

> kernel tree for if we are unable to successfully allocate memory
> for the structure pointer,sinfo of type skt_dev_info and need to
> clean up the memory already allocated to the clk structure pointer,
> clk by calling clk_get on it and freeing the no longer required
> mermory for this structure pointer.

This makes no sense.  clk_get() itself doesn't allocate any memory.  As
usual, you act as a mechanical automatom which doesn't understand what
you're doing or you just guess.  I don't care which it is, you are a
danger to the kernel by doing this.  As many other experienced kernel
developers have told you, please stop.

In any case, I'm NAKing your patch as there's better ways to solve this.
That's where experience and research come in.

Nevertheless, thanks for pointing out the oversight, and I notice that
there are a few more cases too.

-- 
FTTC broadband for 0.8mile line: currently at 10.5Mbps down 400kbps up
according to speedtest.net.

___
Linux PCMCIA reimplementation list
http://lists.infradead.org/mailman/listinfo/linux-pcmcia