aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/mtd
diff options
context:
space:
mode:
authorAndrey Smirnov <andrew.smirnov@gmail.com>2016-07-21 17:59:21 -0400
committerBoris Brezillon <boris.brezillon@free-electrons.com>2016-09-23 03:35:16 -0400
commitfc6b4d12bc394aa9b5c22aa3a2f5128ad6c84a72 (patch)
tree3106187e2dd999b09d5ea7910bb6bc7f5f3788d8 /drivers/mtd
parent76fe334f71dd20f7eadd4c624441ec7d1fb92f33 (diff)
mtd: nand: Get rid of needless 'goto'
Using "goto" and "switch" statement only makes it harder to follow control flow and doesn't bring any advantages. Rewrite the code to avoid using "goto". Signed-off-by: Brian Norris <computersforpeace@gmail.com> Signed-off-by: Andrey Smirnov <andrew.smirnov@gmail.com> Signed-off-by: Boris Brezillon <boris.brezillon@free-electrons.com>
Diffstat (limited to 'drivers/mtd')
-rw-r--r--drivers/mtd/nand/nand_base.c18
1 files changed, 6 insertions, 12 deletions
diff --git a/drivers/mtd/nand/nand_base.c b/drivers/mtd/nand/nand_base.c
index 7f742c9c9015..108adefcc8cc 100644
--- a/drivers/mtd/nand/nand_base.c
+++ b/drivers/mtd/nand/nand_base.c
@@ -2162,7 +2162,7 @@ static int nand_do_read_oob(struct mtd_info *mtd, loff_t from,
2162static int nand_read_oob(struct mtd_info *mtd, loff_t from, 2162static int nand_read_oob(struct mtd_info *mtd, loff_t from,
2163 struct mtd_oob_ops *ops) 2163 struct mtd_oob_ops *ops)
2164{ 2164{
2165 int ret = -ENOTSUPP; 2165 int ret;
2166 2166
2167 ops->retlen = 0; 2167 ops->retlen = 0;
2168 2168
@@ -2173,24 +2173,18 @@ static int nand_read_oob(struct mtd_info *mtd, loff_t from,
2173 return -EINVAL; 2173 return -EINVAL;
2174 } 2174 }
2175 2175
2176 nand_get_device(mtd, FL_READING); 2176 if (ops->mode != MTD_OPS_PLACE_OOB &&
2177 2177 ops->mode != MTD_OPS_AUTO_OOB &&
2178 switch (ops->mode) { 2178 ops->mode != MTD_OPS_RAW)
2179 case MTD_OPS_PLACE_OOB: 2179 return -ENOTSUPP;
2180 case MTD_OPS_AUTO_OOB:
2181 case MTD_OPS_RAW:
2182 break;
2183 2180
2184 default: 2181 nand_get_device(mtd, FL_READING);
2185 goto out;
2186 }
2187 2182
2188 if (!ops->datbuf) 2183 if (!ops->datbuf)
2189 ret = nand_do_read_oob(mtd, from, ops); 2184 ret = nand_do_read_oob(mtd, from, ops);
2190 else 2185 else
2191 ret = nand_do_read_ops(mtd, from, ops); 2186 ret = nand_do_read_ops(mtd, from, ops);
2192 2187
2193out:
2194 nand_release_device(mtd); 2188 nand_release_device(mtd);
2195 return ret; 2189 return ret;
2196} 2190}