]> git.ipfire.org Git - thirdparty/kernel/stable.git/commitdiff
mtd: nand: remove unused and buggy get_platform_nandchip() helper function
authorBoris BREZILLON <boris.brezillon@free-electrons.com>
Mon, 14 Dec 2015 15:13:31 +0000 (16:13 +0100)
committerLuis Henriques <luis.henriques@canonical.com>
Tue, 2 Feb 2016 19:35:00 +0000 (19:35 +0000)
commit 8142b47ef33c655a34e08efd46b65732fe190675 upstream.

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>
Signed-off-by: Brian Norris <computersforpeace@gmail.com>
[ luis: backported to 3.16: adjusted context ]
Signed-off-by: Luis Henriques <luis.henriques@canonical.com>
drivers/mtd/nand/plat_nand.c
include/linux/mtd/nand.h

index 0b068a5c0bff3c05aa2eba8e1ae93a01f6b8db98..d6fe74f5f208be448213559e1809bb250d38319a 100644 (file)
@@ -59,7 +59,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;
        data->mtd.priv = &data->chip;
        data->mtd.owner = THIS_MODULE;
        data->mtd.name = dev_name(&pdev->dev);
index 2b468f73f53ddf8023f5aaa1939deac0ccce9e63..6ea81247968e3af00d7b3d7ab6e5601d8e42786e 100644 (file)
@@ -882,15 +882,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)
 {