Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1446555
| From | Andrey Smirnov <andrew.smirnov@gmail.com> |
|---|---|
| Newsgroups | linux.kernel |
| Subject | [PATCH 2/2] mtd: nand: Get rid of needless 'goto' |
| Date | 2016-07-19 17:50 +0200 |
| Message-ID | <rWFrr-5Qf-1@gated-at.bofh.it> (permalink) |
| References | <rWFrr-5Qf-3@gated-at.bofh.it> |
| Organization | linux.* mail to news gateway |
Using "goto" in that "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: Andrey Smirnov <andrew.smirnov@gmail.com> --- drivers/mtd/nand/nand_base.c | 13 +++++-------- 1 file changed, 5 insertions(+), 8 deletions(-) diff --git a/drivers/mtd/nand/nand_base.c b/drivers/mtd/nand/nand_base.c index 57043a6..8fa5536 100644 --- a/drivers/mtd/nand/nand_base.c +++ b/drivers/mtd/nand/nand_base.c @@ -2139,18 +2139,15 @@ static int nand_read_oob(struct mtd_info *mtd, loff_t from, case MTD_OPS_PLACE_OOB: case MTD_OPS_AUTO_OOB: case MTD_OPS_RAW: + if (!ops->datbuf) + ret = nand_do_read_oob(mtd, from, ops); + else + ret = nand_do_read_ops(mtd, from, ops); break; - default: - goto out; + break; } - if (!ops->datbuf) - ret = nand_do_read_oob(mtd, from, ops); - else - ret = nand_do_read_ops(mtd, from, ops); - -out: nand_release_device(mtd); return ret; } -- 2.5.5
Back to linux.kernel | Previous | Next — Next in thread | Find similar | Unroll thread
[PATCH 2/2] mtd: nand: Get rid of needless 'goto' Andrey Smirnov <andrew.smirnov@gmail.com> - 2016-07-19 17:50 +0200
Re: [PATCH 2/2] mtd: nand: Get rid of needless 'goto' Brian Norris <computersforpeace@gmail.com> - 2016-07-19 20:40 +0200
Re: [PATCH 2/2] mtd: nand: Get rid of needless 'goto' Andrey Smirnov <andrew.smirnov@gmail.com> - 2016-07-19 20:50 +0200
Re: [PATCH 2/2] mtd: nand: Get rid of needless 'goto' Boris Brezillon <boris.brezillon@free-electrons.com> - 2016-07-19 21:00 +0200
Re: [PATCH 2/2] mtd: nand: Get rid of needless 'goto' Brian Norris <computersforpeace@gmail.com> - 2016-07-19 21:50 +0200
csiph-web