summaryrefslogtreecommitdiffstats
path: root/drivers/mtd/nand
diff options
context:
space:
mode:
authorRinHizakura <s921975628@gmail.com>2021-12-25 18:06:48 +0800
committerMiquel Raynal <miquel.raynal@bootlin.com>2022-01-23 16:37:05 +0100
commitdb52b445793d8e4ffe9b53ff749a55470b900984 (patch)
tree2d1168938613e900127dd45a88f21f00298eb38e /drivers/mtd/nand
parente0a9ddd5d9e1c66caefda825b3cea8ea9bd21bf0 (diff)
downloadlinux-db52b445793d8e4ffe9b53ff749a55470b900984.tar.bz2
mtd: rawnand: nandsim: Merge repeat codes in ns_switch_state
The moving block of codes is shared between both 'if' and 'else' condition, we can move it out to reduce the duplication. Signed-off-by: RinHizakura <s921975628@gmail.com> Reviewed-by: Richard Weinberger <richard@nod.at> Signed-off-by: Miquel Raynal <miquel.raynal@bootlin.com> Link: https://lore.kernel.org/linux-mtd/20211225100648.119011-1-s921975628@gmail.com
Diffstat (limited to 'drivers/mtd/nand')
-rw-r--r--drivers/mtd/nand/raw/nandsim.c19
1 files changed, 6 insertions, 13 deletions
diff --git a/drivers/mtd/nand/raw/nandsim.c b/drivers/mtd/nand/raw/nandsim.c
index 3698fb430f81..2ef6bddf0ab9 100644
--- a/drivers/mtd/nand/raw/nandsim.c
+++ b/drivers/mtd/nand/raw/nandsim.c
@@ -1731,14 +1731,6 @@ static void ns_switch_state(struct nandsim *ns)
"state: %s, nxstate: %s\n",
ns_get_state_name(ns->state),
ns_get_state_name(ns->nxstate));
-
- /* See, whether we need to do some action */
- if ((ns->state & ACTION_MASK) &&
- ns_do_state_action(ns, ns->state) < 0) {
- ns_switch_to_ready_state(ns, NS_STATUS_FAILED(ns));
- return;
- }
-
} else {
/*
* We don't yet know which operation we perform.
@@ -1755,12 +1747,13 @@ static void ns_switch_state(struct nandsim *ns)
if (ns_find_operation(ns, 0))
return;
+ }
- if ((ns->state & ACTION_MASK) &&
- ns_do_state_action(ns, ns->state) < 0) {
- ns_switch_to_ready_state(ns, NS_STATUS_FAILED(ns));
- return;
- }
+ /* See, whether we need to do some action */
+ if ((ns->state & ACTION_MASK) &&
+ ns_do_state_action(ns, ns->state) < 0) {
+ ns_switch_to_ready_state(ns, NS_STATUS_FAILED(ns));
+ return;
}
/* For 16x devices column means the page offset in words */