Skip to content

Commit 00b102d

Browse files
ISCAS-Vulabmiquelraynal
authored andcommitted
mtd: bcm47xxnflash: Add error handling for bcm47xxnflash_ops_bcm4706_ctl_cmd()
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 <[email protected]> Signed-off-by: Miquel Raynal <[email protected]>
1 parent 529cbc9 commit 00b102d

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

drivers/mtd/nand/raw/bcm47xxnflash/ops_bcm4706.c

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -171,6 +171,7 @@ static void bcm47xxnflash_ops_bcm4706_cmd_ctrl(struct nand_chip *nand_chip,
171171
{
172172
struct bcm47xxnflash *b47n = nand_get_controller_data(nand_chip);
173173
u32 code = 0;
174+
int rc;
174175

175176
if (cmd == NAND_CMD_NONE)
176177
return;
@@ -182,7 +183,9 @@ static void bcm47xxnflash_ops_bcm4706_cmd_ctrl(struct nand_chip *nand_chip,
182183
if (cmd != NAND_CMD_RESET)
183184
code |= NCTL_CSA;
184185

185-
bcm47xxnflash_ops_bcm4706_ctl_cmd(b47n->cc, code);
186+
rc = bcm47xxnflash_ops_bcm4706_ctl_cmd(b47n->cc, code);
187+
if (rc)
188+
pr_err("ctl_cmd didn't work with error %d\n", rc);
186189
}
187190

188191
/* Default nand_select_chip calls cmd_ctrl, which is not used in BCM4706 */

0 commit comments

Comments
 (0)