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

Commit cf446f0d authored by Ed L. Cashin's avatar Ed L. Cashin Committed by Linus Torvalds
Browse files

aoe: eliminate goto and improve readability



Adam Richter suggested eliminating this goto.

Signed-off-by: default avatarEd L. Cashin <ecashin@coraid.com>
Cc: Greg KH <greg@kroah.com>
Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
parent 468fc530
Loading
Loading
Loading
Loading
+34 −35
Original line number Diff line number Diff line
@@ -194,12 +194,15 @@ aoechr_read(struct file *filp, char __user *buf, size_t cnt, loff_t *off)
	ulong flags;

	n = (unsigned long) filp->private_data;
	switch (n) {
	case MINOR_ERR:
	if (n != MINOR_ERR)
		return -EFAULT;

	spin_lock_irqsave(&emsgs_lock, flags);
loop:

	for (;;) {
		em = emsgs + emsgs_head_idx;
		if ((em->flags & EMFL_VALID) == 0) {
		if ((em->flags & EMFL_VALID) != 0)
			break;
		if (filp->f_flags & O_NDELAY) {
			spin_unlock_irqrestore(&emsgs_lock, flags);
			return -EAGAIN;
@@ -218,7 +221,6 @@ loop:
			spin_unlock_irqrestore(&emsgs_lock, flags);
			return -ERESTARTSYS;
		}
			goto loop;
	}
	if (em->len > cnt) {
		spin_unlock_irqrestore(&emsgs_lock, flags);
@@ -237,9 +239,6 @@ loop:
	n = copy_to_user(buf, mp, len);
	kfree(mp);
	return n == 0 ? len : -EFAULT;
	default:
		return -EFAULT;
	}
}

static const struct file_operations aoe_fops = {