mtd: nand: Make sure drivers not supporting SET/GET_FEATURES return -ENOTSUPP
authorBoris Brezillon <boris.brezillon@free-electrons.com>
Fri, 26 May 2017 15:10:15 +0000 (17:10 +0200)
committerBoris Brezillon <boris.brezillon@free-electrons.com>
Tue, 30 May 2017 06:59:26 +0000 (08:59 +0200)
commit4a78cc644eed3cf2dae00c3a959910a86c140fd6
tree38f3d52750e2761fe156bb11f2e9f5c4907b86d4
parentcc0f51ec111266f5d255e753bf3254ad411d5c12
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>
15 files changed:
drivers/mtd/nand/bcm47xxnflash/ops_bcm4706.c
drivers/mtd/nand/cafe_nand.c
drivers/mtd/nand/denali.c
drivers/mtd/nand/docg4.c
drivers/mtd/nand/fsl_elbc_nand.c
drivers/mtd/nand/fsl_ifc_nand.c
drivers/mtd/nand/hisi504_nand.c
drivers/mtd/nand/mpc5121_nfc.c
drivers/mtd/nand/nand_base.c
drivers/mtd/nand/pxa3xx_nand.c
drivers/mtd/nand/qcom_nandc.c
drivers/mtd/nand/sh_flctl.c
drivers/mtd/nand/vf610_nfc.c
drivers/staging/mt29f_spinand/mt29f_spinand.c
include/linux/mtd/nand.h