]> git.ipfire.org Git - thirdparty/linux.git/commitdiff
mtd: bcm47xxnflash: Add error handling for bcm47xxnflash_ops_bcm4706_ctl_cmd()
authorWentao Liang <vulab@iscas.ac.cn>
Tue, 22 Apr 2025 04:14:16 +0000 (12:14 +0800)
committerMiquel Raynal <miquel.raynal@bootlin.com>
Tue, 29 Apr 2025 09:05:35 +0000 (11:05 +0200)
The function bcm47xxnflash_ops_bcm4706_cmd_ctrl() calls the function
bcm47xxnflash_ops_bcm4706_ctl_cmd(), but does not check its return value.
A proper implementation can be found in bcm47xxnflash_ops_bcm4706_write().

Add error log to the bcm47xxnflash_ops_bcm4706_ctl_cmd() via pr_err()
to prevent silent failure. The error Log funciton 'dev_err' is unsuitable
in this situation for it is hard to get device pointer.

Signed-off-by: Wentao Liang <vulab@iscas.ac.cn>
Signed-off-by: Miquel Raynal <miquel.raynal@bootlin.com>
drivers/mtd/nand/raw/bcm47xxnflash/ops_bcm4706.c

index 6487dfc642588863d1aa5930df52cbb7c95eba37..e532c3535b162b9bb446cc912ff520509ba11a50 100644 (file)
@@ -171,6 +171,7 @@ static void bcm47xxnflash_ops_bcm4706_cmd_ctrl(struct nand_chip *nand_chip,
 {
        struct bcm47xxnflash *b47n = nand_get_controller_data(nand_chip);
        u32 code = 0;
+       int rc;
 
        if (cmd == NAND_CMD_NONE)
                return;
@@ -182,7 +183,9 @@ static void bcm47xxnflash_ops_bcm4706_cmd_ctrl(struct nand_chip *nand_chip,
        if (cmd != NAND_CMD_RESET)
                code |= NCTL_CSA;
 
-       bcm47xxnflash_ops_bcm4706_ctl_cmd(b47n->cc, code);
+       rc = bcm47xxnflash_ops_bcm4706_ctl_cmd(b47n->cc, code);
+       if (rc)
+               pr_err("ctl_cmd didn't work with error %d\n", rc);
 }
 
 /* Default nand_select_chip calls cmd_ctrl, which is not used in BCM4706 */