Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 5981dfce authored by Tokunori Ikegami's avatar Tokunori Ikegami Committed by Vignesh Raghavendra
Browse files

mtd: cfi_cmdset_0002: Remove goto statement from do_write_buffer()



Remove goto statement from do_write_buffer() to simplify the code flow.

Cc: Fabio Bettoni <fbettoni@gmail.com>
Co: Hauke Mehrtens <hauke@hauke-m.de>
Cc: Chris Packham <chris.packham@alliedtelesis.co.nz>
Cc: Joakim Tjernlund <Joakim.Tjernlund@infinera.com>
Cc: linux-mtd@lists.infradead.org
Signed-off-by: default avatarTokunori Ikegami <ikegami.t@gmail.com>
[vigneshr@ti.com: Reword commit message]
Signed-off-by: default avatarVignesh Raghavendra <vigneshr@ti.com>
parent 37c673ad
Loading
Loading
Loading
Loading
+27 −26
Original line number Diff line number Diff line
@@ -1979,18 +1979,19 @@ static int __xipram do_write_buffer(struct map_info *map, struct flchip *chip,
		 * the failure due to scheduling.
		 */
		if (time_after(jiffies, timeo) &&
		    !chip_good(map, chip, adr, datum))
		    !chip_good(map, chip, adr, datum)) {
			ret = -EIO;
			break;

		if (chip_good(map, chip, adr, datum)) {
			xip_enable(map, chip, adr);
			goto op_done;
		}

		if (chip_good(map, chip, adr, datum))
			break;

		/* Latency issues. Drop the lock, wait a while and retry */
		UDELAY(map, chip, adr, 1);
	}

	if (ret) {
		/*
		 * Recovery from write-buffer programming failures requires
		 * the write-to-buffer-reset sequence.  Since the last part
@@ -2006,14 +2007,14 @@ static int __xipram do_write_buffer(struct map_info *map, struct flchip *chip,
				 cfi->device_type, NULL);
		cfi_send_gen_cmd(0xF0, cfi->addr_unlock1, chip->start, map, cfi,
				 cfi->device_type, NULL);
	xip_enable(map, chip, adr);
		/* FIXME - should have reset delay before continuing */

	printk(KERN_WARNING "MTD %s(): software timeout, address:0x%.8lx.\n",
		pr_err("MTD %s(): software timeout, address:0x%.8lx.\n",
		       __func__, adr);
	}

	xip_enable(map, chip, adr);

	ret = -EIO;
 op_done:
	chip->state = FL_READY;
	DISABLE_VPP(map);
	put_chip(map, chip, adr);