public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Peter Senna Tschudin <peter.senna@collabora.com>
To: thomas@winischhofer.net, gregkh@linuxfoundation.org,
	linux-usb@vger.kernel.org, linux-kernel@vger.kernel.org,
	joe@perches.com, sergei.shtylyov@cogentembedded.com
Cc: Peter Senna Tschudin <peter.senna@gmail.com>,
	Peter Senna Tschudin <peter.senna@collabora.com>
Subject: [PATCH V2 4/7] usb-misc: sisusbvga: Fix coding style: remove assignment from if tests
Date: Fri, 15 Jan 2016 18:41:31 +0100	[thread overview]
Message-ID: <1452879694-21206-5-git-send-email-peter.senna@collabora.com> (raw)
In-Reply-To: <1452879694-21206-1-git-send-email-peter.senna@collabora.com>

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 assignment outside the test. The changes
also fix the remaining 2 lines that were over 80 characters.

Signed-off-by: Peter Senna Tschudin <peter.senna@collabora.com>
---
No changes from V1.

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 26925f7..40f360a 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

  parent reply	other threads:[~2016-01-15 17:43 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-01-15 17:41 [PATCH V2 0/7] usb-misc: sisusbvga: cleanup and bug fix Peter Senna Tschudin
2016-01-15 17:41 ` [PATCH V2 1/7] usb-misc: sisusbvga: Fix coding style: horizontal whitespace changes Peter Senna Tschudin
2016-01-15 17:56   ` Joe Perches
2016-01-15 18:09     ` Peter Senna
2016-01-15 18:21       ` Alan Stern
2016-01-15 17:41 ` [PATCH V2 2/7] usb-misc: sisusbvga: Fix coding style: vertical " Peter Senna Tschudin
2016-01-15 17:41 ` [PATCH V2 3/7] usb-misc: sisusbvga: Fix coding style: braces, parenthesis, comment Peter Senna Tschudin
2016-01-15 17:41 ` Peter Senna Tschudin [this message]
2016-01-15 17:41 ` [PATCH V2 5/7] usb-misc: sisusbvga: Remove null test before calls to kfree() Peter Senna Tschudin
2016-01-15 17:41 ` [PATCH V2 6/7] usb-misc: sisusbvga: Remove memory allocation logs Peter Senna Tschudin
2016-01-15 17:41 ` [PATCH V2 7/7] usb-misc: sisusbvga: fix error path Peter Senna Tschudin
2016-01-15 17:51 ` [PATCH V2 0/7] usb-misc: sisusbvga: cleanup and bug fix Joe Perches
2016-01-15 18:07   ` Jason Cooper

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1452879694-21206-5-git-send-email-peter.senna@collabora.com \
    --to=peter.senna@collabora.com \
    --cc=gregkh@linuxfoundation.org \
    --cc=joe@perches.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-usb@vger.kernel.org \
    --cc=peter.senna@gmail.com \
    --cc=sergei.shtylyov@cogentembedded.com \
    --cc=thomas@winischhofer.net \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox