aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/mtd/nand/bcm47xxnflash
diff options
context:
space:
mode:
authorBoris Brezillon <boris.brezillon@free-electrons.com>2017-05-26 17:10:15 +0200
committerBoris Brezillon <boris.brezillon@free-electrons.com>2017-05-30 08:59:26 +0200
commit4a78cc644eed3cf2dae00c3a959910a86c140fd6 (patch)
tree38f3d52750e2761fe156bb11f2e9f5c4907b86d4 /drivers/mtd/nand/bcm47xxnflash
parentmtd: nand: export nand_{read,write}_page_raw() (diff)
downloadlinux-dev-4a78cc644eed3cf2dae00c3a959910a86c140fd6.tar.xz
linux-dev-4a78cc644eed3cf2dae00c3a959910a86c140fd6.zip
mtd: nand: Make sure drivers not supporting SET/GET_FEATURES return -ENOTSUPP
A lot of drivers are providing their own ->cmdfunc(), and most of the time this implementation does not support all possible NAND operations. But since ->cmdfunc() cannot return an error code, the core has no way to know that the operation it requested is not supported. This is a problem we cannot address for all kind of operations with the current design, but we can prevent these silent failures for the GET/SET FEATURES operation by overloading the default ->onfi_{set,get}_features() methods with one returning -ENOTSUPP. Reported-by: Chris Packham <Chris.Packham@alliedtelesis.co.nz> Signed-off-by: Boris Brezillon <boris.brezillon@free-electrons.com> Tested-by: Chris Packham <Chris.Packham@alliedtelesis.co.nz>
Diffstat (limited to 'drivers/mtd/nand/bcm47xxnflash')
-rw-r--r--drivers/mtd/nand/bcm47xxnflash/ops_bcm4706.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/drivers/mtd/nand/bcm47xxnflash/ops_bcm4706.c b/drivers/mtd/nand/bcm47xxnflash/ops_bcm4706.c
index f1da4ea88f2c..54bac5b73f0a 100644
--- a/drivers/mtd/nand/bcm47xxnflash/ops_bcm4706.c
+++ b/drivers/mtd/nand/bcm47xxnflash/ops_bcm4706.c
@@ -392,6 +392,8 @@ int bcm47xxnflash_ops_bcm4706_init(struct bcm47xxnflash *b47n)
b47n->nand_chip.read_byte = bcm47xxnflash_ops_bcm4706_read_byte;
b47n->nand_chip.read_buf = bcm47xxnflash_ops_bcm4706_read_buf;
b47n->nand_chip.write_buf = bcm47xxnflash_ops_bcm4706_write_buf;
+ b47n->nand_chip.onfi_set_features = nand_onfi_get_set_features_notsupp;
+ b47n->nand_chip.onfi_get_features = nand_onfi_get_set_features_notsupp;
nand_chip->chip_delay = 50;
b47n->nand_chip.bbt_options = NAND_BBT_USE_FLASH;