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>
This commit is contained in:
@@ -1812,6 +1812,8 @@ static int alloc_nand_resource(struct platform_device *pdev)
|
||||
chip->write_buf = pxa3xx_nand_write_buf;
|
||||
chip->options |= NAND_NO_SUBPAGE_WRITE;
|
||||
chip->cmdfunc = nand_cmdfunc;
|
||||
chip->onfi_set_features = nand_onfi_get_set_features_notsupp;
|
||||
chip->onfi_get_features = nand_onfi_get_set_features_notsupp;
|
||||
}
|
||||
|
||||
nand_hw_control_init(chip->controller);
|
||||
|
Reference in New Issue
Block a user