From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1757741AbcBCWiH (ORCPT ); Wed, 3 Feb 2016 17:38:07 -0500 Received: from youngberry.canonical.com ([91.189.89.112]:47205 "EHLO youngberry.canonical.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1757691AbcBCWh6 (ORCPT ); Wed, 3 Feb 2016 17:37:58 -0500 From: Luis Henriques To: linux-kernel@vger.kernel.org, stable@vger.kernel.org, kernel-team@lists.ubuntu.com Cc: Boris Brezillon , Vitaly Wool , Brian Norris , Luis Henriques Subject: [PATCH 3.16.y-ckt 149/180] mtd: nand: remove unused and buggy get_platform_nandchip() helper function Date: Wed, 3 Feb 2016 22:32:35 +0000 Message-Id: <1454538786-12215-150-git-send-email-luis.henriques@canonical.com> In-Reply-To: <1454538786-12215-1-git-send-email-luis.henriques@canonical.com> References: <1454538786-12215-1-git-send-email-luis.henriques@canonical.com> X-Extended-Stable: 3.16 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 3.16.7-ckt24 -stable review patch. If anyone has any objections, please let me know. ---8<------------------------------------------------------------ From: Boris BREZILLON 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 Fixes: 711fdf627ce1 ("[MTD] [NAND] platform NAND driver: add driver") Cc: Vitaly Wool Signed-off-by: Brian Norris [ luis: backported to 3.16: adjusted context ] Signed-off-by: Luis Henriques --- 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 0b068a5c0bff..d6fe74f5f208 100644 --- a/drivers/mtd/nand/plat_nand.c +++ b/drivers/mtd/nand/plat_nand.c @@ -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); diff --git a/include/linux/mtd/nand.h b/include/linux/mtd/nand.h index 2b468f73f53d..6ea81247968e 100644 --- a/include/linux/mtd/nand.h +++ b/include/linux/mtd/nand.h @@ -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) {