Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1301715

[PATCH 3/5] usb-misc: sisusbvga: Remove assignments from if tests

From Peter Senna Tschudin <peter.senna@collabora.com>
Newsgroups linux.kernel
Subject [PATCH 3/5] usb-misc: sisusbvga: Remove assignments from if tests
Date 2016-01-05 18:00 +0100
Message-ID <qND7J-5u9-29@gated-at.bofh.it> (permalink)
References <qND7I-5u9-5@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


From: Peter Senna Tschudin <peter.senna@gmail.com>

The file drivers/usb/misc/sisusbvga/sisusb.c had 6 assignments inside if
tests. This patch move the assignement outside the test.

Signed-off-by: Peter Senna Tschudin <peter.senna@collabora.com>
---
Tested by compilation only.

 drivers/usb/misc/sisusbvga/sisusb.c | 18 ++++++++++++------
 1 file changed, 12 insertions(+), 6 deletions(-)

diff --git a/drivers/usb/misc/sisusbvga/sisusb.c b/drivers/usb/misc/sisusbvga/sisusb.c
index e6bb1ad..6cce4fb 100644
--- a/drivers/usb/misc/sisusbvga/sisusb.c
+++ b/drivers/usb/misc/sisusbvga/sisusb.c
@@ -1378,7 +1378,8 @@ static int sisusb_clear_vram(struct sisusb_usb_data *sisusb,
 		return 0;
 
 	/* allocate free buffer/urb and clear the buffer */
-	if ((i = sisusb_alloc_outbuf(sisusb)) < 0)
+	i = sisusb_alloc_outbuf(sisusb);
+	if (i < 0)
 		return -EBUSY;
 
 	memset(sisusb->obuf[i], 0, sisusb->obufsize);
@@ -3067,7 +3068,8 @@ static int sisusb_probe(struct usb_interface *intf,
 
 	/* Allocate buffers */
 	sisusb->ibufsize = SISUSB_IBUF_SIZE;
-	if (!(sisusb->ibuf = kmalloc(SISUSB_IBUF_SIZE, GFP_KERNEL))) {
+	sisusb->ibuf = kmalloc(SISUSB_IBUF_SIZE, GFP_KERNEL);
+	if (!sisusb->ibuf) {
 		dev_err(&sisusb->sisusb_dev->dev, "Failed to allocate memory for input buffer");
 		retval = -ENOMEM;
 		goto error_2;
@@ -3076,7 +3078,8 @@ static int sisusb_probe(struct usb_interface *intf,
 	sisusb->numobufs = 0;
 	sisusb->obufsize = SISUSB_OBUF_SIZE;
 	for (i = 0; i < NUMOBUFS; i++) {
-		if (!(sisusb->obuf[i] = kmalloc(SISUSB_OBUF_SIZE, GFP_KERNEL))) {
+		sisusb->obuf[i] = kmalloc(SISUSB_OBUF_SIZE, GFP_KERNEL);
+		if (!sisusb->obuf[i]) {
 			if (i == 0) {
 				dev_err(&sisusb->sisusb_dev->dev, "Failed to allocate memory for output buffer\n");
 				retval = -ENOMEM;
@@ -3088,7 +3091,8 @@ static int sisusb_probe(struct usb_interface *intf,
 	}
 
 	/* Allocate URBs */
-	if (!(sisusb->sisurbin = usb_alloc_urb(0, GFP_KERNEL))) {
+	sisusb->sisurbin = usb_alloc_urb(0, GFP_KERNEL);
+	if (!sisusb->sisurbin) {
 		dev_err(&sisusb->sisusb_dev->dev, "Failed to allocate URBs\n");
 		retval = -ENOMEM;
 		goto error_3;
@@ -3096,7 +3100,8 @@ static int sisusb_probe(struct usb_interface *intf,
 	sisusb->completein = 1;
 
 	for (i = 0; i < sisusb->numobufs; i++) {
-		if (!(sisusb->sisurbout[i] = usb_alloc_urb(0, GFP_KERNEL))) {
+		sisusb->sisurbout[i] = usb_alloc_urb(0, GFP_KERNEL);
+		if (!sisusb->sisurbout[i]) {
 			dev_err(&sisusb->sisusb_dev->dev,
 					"Failed to allocate URBs\n");
 			retval = -ENOMEM;
@@ -3112,7 +3117,8 @@ static int sisusb_probe(struct usb_interface *intf,
 
 #ifdef INCL_SISUSB_CON
 	/* Allocate our SiS_Pr */
-	if (!(sisusb->SiS_Pr = kmalloc(sizeof(struct SiS_Private), GFP_KERNEL))) {
+	sisusb->SiS_Pr = kmalloc(sizeof(struct SiS_Private), GFP_KERNEL);
+	if (!sisusb->SiS_Pr) {
 		dev_err(&sisusb->sisusb_dev->dev, "Failed to allocate SiS_Pr\n");
 	}
 #endif
-- 
2.5.0

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Back to linux.kernel | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

[PATCH 0/5] usb-misc: cleanup sisusbvga Peter Senna Tschudin <peter.senna@collabora.com> - 2016-01-05 18:00 +0100
  [PATCH 5/5] usb-misc: sisusbvga: Remove null test before kfree() Peter Senna Tschudin <peter.senna@collabora.com> - 2016-01-05 18:00 +0100
  [PATCH 3/5] usb-misc: sisusbvga: Remove assignments from if tests Peter Senna Tschudin <peter.senna@collabora.com> - 2016-01-05 18:00 +0100
  Re: [PATCH 0/5] usb-misc: cleanup sisusbvga Joe Perches <joe@perches.com> - 2016-01-05 20:00 +0100
    Re: [PATCH 0/5] usb-misc: cleanup sisusbvga Peter Senna Tschudin <peter.senna@collabora.com> - 2016-01-06 16:40 +0100
      Re: [PATCH 0/5] usb-misc: cleanup sisusbvga Joe Perches <joe@perches.com> - 2016-01-06 17:10 +0100

csiph-web