mtd: st_spi_fsm: Simplify error checking in .probe() a bit
authorUwe Kleine-König <u.kleine-koenig@pengutronix.de>
Tue, 7 Jun 2022 15:24:58 +0000 (17:24 +0200)
committerMiquel Raynal <miquel.raynal@bootlin.com>
Thu, 9 Jun 2022 13:06:38 +0000 (15:06 +0200)
Instead of ending each if branch with the same check, do it once
unconditionally after the if block.

Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
Signed-off-by: Miquel Raynal <miquel.raynal@bootlin.com>
Link: https://lore.kernel.org/linux-mtd/20220607152458.232847-5-u.kleine-koenig@pengutronix.de
drivers/mtd/devices/st_spi_fsm.c

index 9f6d4dd8bade330eb42d114f84fdc528972bfbff..54861d889c3096a8f74ff1c828ececd5d2bb6e95 100644 (file)
@@ -2084,15 +2084,12 @@ static int stfsm_probe(struct platform_device *pdev)
         * Configure READ/WRITE/ERASE sequences according to platform and
         * device flags.
         */
-       if (info->config) {
+       if (info->config)
                ret = info->config(fsm);
-               if (ret)
-                       goto err_clk_unprepare;
-       } else {
+       else
                ret = stfsm_prepare_rwe_seqs_default(fsm);
-               if (ret)
-                       goto err_clk_unprepare;
-       }
+       if (ret)
+               goto err_clk_unprepare;
 
        fsm->mtd.name           = info->name;
        fsm->mtd.dev.parent     = &pdev->dev;