Commit 7f252717 authored by Joe Perches's avatar Joe Perches Committed by Linus Torvalds

drivers/block/floppy.c: convert raw_cmd_copyin from while(1) to label: goto

Reduces indent.
Makes a bit more readable and intelligible.
Return value now at bottom of function.
Signed-off-by: default avatarJoe Perches <joe@perches.com>
Cc: Stephen Hemminger <shemminger@vyatta.com>
Cc: Jens Axboe <jens.axboe@oracle.com>
Cc: Marcin Slusarz <marcin.slusarz@gmail.com>
Cc: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
parent ce2f11fe
...@@ -3126,6 +3126,7 @@ static inline int raw_cmd_copyout(int cmd, void __user *param, ...@@ -3126,6 +3126,7 @@ static inline int raw_cmd_copyout(int cmd, void __user *param,
} }
ptr = ptr->next; ptr = ptr->next;
} }
return 0; return 0;
} }
...@@ -3156,7 +3157,8 @@ static inline int raw_cmd_copyin(int cmd, void __user *param, ...@@ -3156,7 +3157,8 @@ static inline int raw_cmd_copyin(int cmd, void __user *param,
int i; int i;
*rcmd = NULL; *rcmd = NULL;
while (1) {
loop:
ptr = kmalloc(sizeof(struct floppy_raw_cmd), GFP_USER); ptr = kmalloc(sizeof(struct floppy_raw_cmd), GFP_USER);
if (!ptr) if (!ptr)
return -ENOMEM; return -ENOMEM;
...@@ -3186,24 +3188,25 @@ static inline int raw_cmd_copyin(int cmd, void __user *param, ...@@ -3186,24 +3188,25 @@ static inline int raw_cmd_copyin(int cmd, void __user *param,
if (ptr->flags & (FD_RAW_READ | FD_RAW_WRITE)) { if (ptr->flags & (FD_RAW_READ | FD_RAW_WRITE)) {
if (ptr->length <= 0) if (ptr->length <= 0)
return -EINVAL; return -EINVAL;
ptr->kernel_data = ptr->kernel_data = (char *)fd_dma_mem_alloc(ptr->length);
(char *)fd_dma_mem_alloc(ptr->length);
fallback_on_nodma_alloc(&ptr->kernel_data, ptr->length); fallback_on_nodma_alloc(&ptr->kernel_data, ptr->length);
if (!ptr->kernel_data) if (!ptr->kernel_data)
return -ENOMEM; return -ENOMEM;
ptr->buffer_length = ptr->length; ptr->buffer_length = ptr->length;
} }
if (ptr->flags & FD_RAW_WRITE) { if (ptr->flags & FD_RAW_WRITE) {
ret = fd_copyin(ptr->data, ptr->kernel_data, ret = fd_copyin(ptr->data, ptr->kernel_data, ptr->length);
ptr->length);
if (ret) if (ret)
return ret; return ret;
} }
if (ptr->flags & FD_RAW_MORE) {
rcmd = &(ptr->next); rcmd = &(ptr->next);
if (!(ptr->flags & FD_RAW_MORE))
return 0;
ptr->rate &= 0x43; ptr->rate &= 0x43;
goto loop;
} }
return 0;
} }
static int raw_cmd_ioctl(int cmd, void __user *param) static int raw_cmd_ioctl(int cmd, void __user *param)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment