提交 2fcdbdfd 编写于 作者: G Greg Kroah-Hartman

USB: usblp.c: move assignment out of if () block

We should not be doing assignments within an if () block
so fix up the code to not do this.

change was created using Coccinelle.
Acked-by: NPete Zaitcev <zaitcev@redhat.com>
Signed-off-by: NGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Reviewed-by: NFelipe Balbi <balbi@ti.com>
上级 f354c845
...@@ -660,7 +660,8 @@ static long usblp_ioctl(struct file *file, unsigned int cmd, unsigned long arg) ...@@ -660,7 +660,8 @@ static long usblp_ioctl(struct file *file, unsigned int cmd, unsigned long arg)
switch (cmd) { switch (cmd) {
case LPGETSTATUS: case LPGETSTATUS:
if ((retval = usblp_read_status(usblp, usblp->statusbuf))) { retval = usblp_read_status(usblp, usblp->statusbuf);
if (retval) {
printk_ratelimited(KERN_ERR "usblp%d:" printk_ratelimited(KERN_ERR "usblp%d:"
"failed reading printer status (%d)\n", "failed reading printer status (%d)\n",
usblp->minor, retval); usblp->minor, retval);
...@@ -693,9 +694,11 @@ static struct urb *usblp_new_writeurb(struct usblp *usblp, int transfer_length) ...@@ -693,9 +694,11 @@ static struct urb *usblp_new_writeurb(struct usblp *usblp, int transfer_length)
struct urb *urb; struct urb *urb;
char *writebuf; char *writebuf;
if ((writebuf = kmalloc(transfer_length, GFP_KERNEL)) == NULL) writebuf = kmalloc(transfer_length, GFP_KERNEL);
if (writebuf == NULL)
return NULL; return NULL;
if ((urb = usb_alloc_urb(0, GFP_KERNEL)) == NULL) { urb = usb_alloc_urb(0, GFP_KERNEL);
if (urb == NULL) {
kfree(writebuf); kfree(writebuf);
return NULL; return NULL;
} }
...@@ -732,7 +735,8 @@ static ssize_t usblp_write(struct file *file, const char __user *buffer, size_t ...@@ -732,7 +735,8 @@ static ssize_t usblp_write(struct file *file, const char __user *buffer, size_t
transfer_length = USBLP_BUF_SIZE; transfer_length = USBLP_BUF_SIZE;
rv = -ENOMEM; rv = -ENOMEM;
if ((writeurb = usblp_new_writeurb(usblp, transfer_length)) == NULL) writeurb = usblp_new_writeurb(usblp, transfer_length);
if (writeurb == NULL)
goto raise_urb; goto raise_urb;
usb_anchor_urb(writeurb, &usblp->urbs); usb_anchor_urb(writeurb, &usblp->urbs);
...@@ -980,7 +984,8 @@ static int usblp_submit_read(struct usblp *usblp) ...@@ -980,7 +984,8 @@ static int usblp_submit_read(struct usblp *usblp)
int rc; int rc;
rc = -ENOMEM; rc = -ENOMEM;
if ((urb = usb_alloc_urb(0, GFP_KERNEL)) == NULL) urb = usb_alloc_urb(0, GFP_KERNEL);
if (urb == NULL)
goto raise_urb; goto raise_urb;
usb_fill_bulk_urb(urb, usblp->dev, usb_fill_bulk_urb(urb, usblp->dev,
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册