Skip to contentSkip to conversation

mtd: fix kfree bcm47xxsflash

PATCH In review [email protected] 4 participants 8 messages May 5, 2013 – May 29, 2013 Memory technology devices (MTD)

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 mtd: fix kfree bcm47xxsflash

From: Libo Chen <[email protected]>

mtd is just member of bcm47xxsflash, so we should free bcm47xxsflash not its member.

---
 drivers/mtd/devices/bcm47xxsflash.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/mtd/devices/bcm47xxsflash.c +1 -1
index 9526628..4aa9141 100644
@@ -76,7 +76,7 @@ static int bcm47xxsflash_bcma_probe(struct platform_device *pdev)
 	return 0;
 
 err_dev_reg:
-	kfree(&b47s->mtd);
+	kfree(b47s);
 out:
 	return err;
 }
Signature · 1 line
1.8.1.2
#1 lore raw

Hi David,
what do you think of this patch ?

Quoted 23 lines · On 2013/5/5 16:40, [email protected] wrote:

From: Libo Chen <[email protected]>

mtd is just member of bcm47xxsflash, so we should free bcm47xxsflash not its member.

---
 drivers/mtd/devices/bcm47xxsflash.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/mtd/devices/bcm47xxsflash.c +1 -1
index 9526628..4aa9141 100644
@@ -76,7 +76,7 @@ static int bcm47xxsflash_bcma_probe(struct platform_device *pdev)
 	return 0;
 
 err_dev_reg:
-	kfree(&b47s->mtd);
+	kfree(b47s);
 out:
 	return err;
 }
#2 lore raw

PATCH RESEND 1/1 mtd: fix kfree bcm47xxsflash

In reply to [email protected]

mtd is just member of bcm47xxsflash, so we should free bcm47xxsflash not its member.

---
 drivers/mtd/devices/bcm47xxsflash.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

* add Acked-by: Rafał Miłecki <[email protected]>
* change send list

drivers/mtd/devices/bcm47xxsflash.c +1 -1
index 9526628..4aa9141 100644
@@ -76,7 +76,7 @@ static int bcm47xxsflash_bcma_probe(struct platform_device *pdev)
 	return 0;
 
 err_dev_reg:
-	kfree(&b47s->mtd);
+	kfree(b47s);
 out:
 	return err;
 }
Signature · 1 line
1.8.1.2
#3 lore raw

2013/5/22 Libo Chen <[email protected]>:

Quoted 1 line

mtd is just member of bcm47xxsflash, so we should free bcm47xxsflash not its member.

Thanks!

Signature · 1 line
Rafał
#4 lore raw
In reply to Libo Chen

ping...

Quoted 26 lines · Libo Chen

mtd is just member of bcm47xxsflash, so we should free bcm47xxsflash not its member.

---
 drivers/mtd/devices/bcm47xxsflash.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

* add Acked-by: Rafał Miłecki <[email protected]>
* change send list

drivers/mtd/devices/bcm47xxsflash.c +1 -1
index 9526628..4aa9141 100644
@@ -76,7 +76,7 @@ static int bcm47xxsflash_bcma_probe(struct platform_device *pdev)
 	return 0;
 
 err_dev_reg:
-	kfree(&b47s->mtd);
+	kfree(b47s);
 out:
 	return err;
 }
#5 lore raw

2013/5/28 Libo Chen <[email protected]>:

Quoted 1 line

ping...

It takes a lot of time for someone to pick up mtd patches, just be patient ;)

Signature · 1 line
Rafał
#6 lore raw
In reply to Libo Chen

This is good fix, but I rather prefer not to see it in this shape. See comments below.

Quoted 17 lines · Libo Chen

mtd is just member of bcm47xxsflash, so we should free bcm47xxsflash not its member.

---
 drivers/mtd/devices/bcm47xxsflash.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

* add Acked-by: Rafał Miłecki <[email protected]>
* change send list

drivers/mtd/devices/bcm47xxsflash.c +0 -0
index 9526628..4aa9141 100644

drivers/mtd/devices/bcm47xxsflash.c static int bcm47xxsflash_bcma_probe(struct platform_device *pdev) · line 82

Quoted 8 lines
drivers/mtd/devices/bcm47xxsflash.c +1 -1
@@ -76,7 +76,7 @@ static int bcm47xxsflash_bcma_probe(struct platform_device *pdev)
        return 0;
 
 err_dev_reg:
-       kfree(&b47s->mtd);
+       kfree(b47s);
 out:
        return err;
 }

What about to switch to devm_* and remove those labels and kfrees at all?

Additionally you can add another patch to use module_platform_driver() macro instead of module_init/exit.

--
With Best Regards,
Andy Shevchenko

#7 lore raw
Quoted 32 lines · Andy Shevchenko

This is good fix, but I rather prefer not to see it in this shape. See comments below.

Quoted 17 lines · Libo Chen

mtd is just member of bcm47xxsflash, so we should free bcm47xxsflash not its member.

---
 drivers/mtd/devices/bcm47xxsflash.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

* add Acked-by: Rafał Miłecki <[email protected]>
* change send list

drivers/mtd/devices/bcm47xxsflash.c +0 -0
index 9526628..4aa9141 100644

drivers/mtd/devices/bcm47xxsflash.c static int bcm47xxsflash_bcma_probe(struct platform_device *pdev) · line 82

Quoted 8 lines
drivers/mtd/devices/bcm47xxsflash.c +1 -1
@@ -76,7 +76,7 @@ static int bcm47xxsflash_bcma_probe(struct platform_device *pdev)
        return 0;
 
 err_dev_reg:
-       kfree(&b47s->mtd);
+       kfree(b47s);
 out:
        return err;
 }

What about to switch to devm_* and remove those labels and kfrees at all?

Quoted 3 lines

Additionally you can add another patch to use module_platform_driver() macro instead of module_init/exit.

ok, I will update later.

thanks,

Libo

Quoted 6 lines

--
With Best Regards,
Andy Shevchenko

.