mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git
synced 2024-10-29 23:53:32 +00:00
bus: fsl-mc: Fix test for end of loop
The "desc" pointer can't possibly be NULL here. If we can't find the
correct "desc" then tt points to the last element of the
fsl_mc_accepted_cmds[] array. Fix this by testing if
"i == FSL_MC_NUM_ACCEPTED_CMDS" instead.
Fixes: 2cf1e703f0
("bus: fsl-mc: add fsl-mc userspace support")
Acked-by: Laurentiu Tudor <laurentiu.tudor@nxp.com>
Signed-off-by: Ioana Ciornei <ioana.ciornei@nxp.com>
Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
Link: https://lore.kernel.org/r/20210208170949.3070898-2-ciorneiioana@gmail.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
This commit is contained in:
parent
609cf09c56
commit
ef0fec2214
1 changed files with 1 additions and 1 deletions
|
@ -338,7 +338,7 @@ static int fsl_mc_command_check(struct fsl_mc_device *mc_dev,
|
|||
if ((cmdid & desc->cmdid_mask) == desc->cmdid_value)
|
||||
break;
|
||||
}
|
||||
if (!desc) {
|
||||
if (i == FSL_MC_NUM_ACCEPTED_CMDS) {
|
||||
dev_err(&mc_dev->dev, "MC command 0x%04x: cmdid not accepted\n", cmdid);
|
||||
return -EACCES;
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue