linux-mtd.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] mtd: nand: remove unused and buggy get_platform_nandchip() helper function
@ 2015-12-14 15:13 Boris Brezillon
  2015-12-18 22:33 ` Brian Norris
  0 siblings, 1 reply; 2+ messages in thread
From: Boris Brezillon @ 2015-12-14 15:13 UTC (permalink / raw)
  To: David Woodhouse, Brian Norris, linux-mtd; +Cc: Boris Brezillon, Vitaly Wool

Nobody uses the get_platform_nandchip() helper function which is supposed
to return a pointer to a platform_nand_chip struct from an mtd_info
pointer.
Moreover, this function is buggy since the introduction of the plat_nand
layer (chip->priv is now storing a pointer to an intermediate
plat_nand_data structure allocated in plat_nand_probe(), and we have no
way to retrieve a pointer to the provided platform_nand_chip struct from
this plat_nand_data pointer).

While we are at it, remove the useless (and buggy, since it's pointing to
something stored on the stack) data->chip.priv assignment.

Signed-off-by: Boris Brezillon <boris.brezillon@free-electrons.com>
Fixes: 711fdf627ce1 ("[MTD] [NAND] platform NAND driver: add driver")
Cc: Vitaly Wool <vitalywool@gmail.com>
---
 drivers/mtd/nand/plat_nand.c | 1 -
 include/linux/mtd/nand.h     | 9 ---------
 2 files changed, 10 deletions(-)

diff --git a/drivers/mtd/nand/plat_nand.c b/drivers/mtd/nand/plat_nand.c
index 06ac6c6..73cc94b 100644
--- a/drivers/mtd/nand/plat_nand.c
+++ b/drivers/mtd/nand/plat_nand.c
@@ -56,7 +56,6 @@ static int plat_nand_probe(struct platform_device *pdev)
 	if (IS_ERR(data->io_base))
 		return PTR_ERR(data->io_base);
 
-	data->chip.priv = &data;
 	nand_set_flash_node(&data->chip, pdev->dev.of_node);
 	data->mtd.priv = &data->chip;
 	data->mtd.dev.parent = &pdev->dev;
diff --git a/include/linux/mtd/nand.h b/include/linux/mtd/nand.h
index b614ed2..5491bda0 100644
--- a/include/linux/mtd/nand.h
+++ b/include/linux/mtd/nand.h
@@ -930,15 +930,6 @@ struct platform_nand_data {
 	struct platform_nand_ctrl ctrl;
 };
 
-/* Some helpers to access the data structures */
-static inline
-struct platform_nand_chip *get_platform_nandchip(struct mtd_info *mtd)
-{
-	struct nand_chip *chip = mtd->priv;
-
-	return chip->priv;
-}
-
 /* return the supported features. */
 static inline int onfi_feature(struct nand_chip *chip)
 {
-- 
2.1.4

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

* Re: [PATCH] mtd: nand: remove unused and buggy get_platform_nandchip() helper function
  2015-12-14 15:13 [PATCH] mtd: nand: remove unused and buggy get_platform_nandchip() helper function Boris Brezillon
@ 2015-12-18 22:33 ` Brian Norris
  0 siblings, 0 replies; 2+ messages in thread
From: Brian Norris @ 2015-12-18 22:33 UTC (permalink / raw)
  To: Boris Brezillon; +Cc: David Woodhouse, linux-mtd, Vitaly Wool

On Mon, Dec 14, 2015 at 04:13:31PM +0100, Boris Brezillon wrote:
> Nobody uses the get_platform_nandchip() helper function which is supposed
> to return a pointer to a platform_nand_chip struct from an mtd_info
> pointer.
> Moreover, this function is buggy since the introduction of the plat_nand
> layer (chip->priv is now storing a pointer to an intermediate
> plat_nand_data structure allocated in plat_nand_probe(), and we have no
> way to retrieve a pointer to the provided platform_nand_chip struct from
> this plat_nand_data pointer).
> 
> While we are at it, remove the useless (and buggy, since it's pointing to
> something stored on the stack) data->chip.priv assignment.
> 
> Signed-off-by: Boris Brezillon <boris.brezillon@free-electrons.com>
> Fixes: 711fdf627ce1 ("[MTD] [NAND] platform NAND driver: add driver")
> Cc: Vitaly Wool <vitalywool@gmail.com>

Applied to l2-mtd.git

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

end of thread, other threads:[~2015-12-18 22:33 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-12-14 15:13 [PATCH] mtd: nand: remove unused and buggy get_platform_nandchip() helper function Boris Brezillon
2015-12-18 22:33 ` Brian Norris

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).