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 5/7] usb-misc: sisusbvga: Remove null test before calls to kfree()
Date: Fri, 15 Jan 2016 18:41:32 +0100	[thread overview]
Message-ID: <1452879694-21206-6-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>

This patch removes null test before calls to kfree() as kfree() can
handle null pointers safely.

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

Tested by compilation only.

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

diff --git a/drivers/usb/misc/sisusbvga/sisusb.c b/drivers/usb/misc/sisusbvga/sisusb.c
index 40f360a..bea6d88 100644
--- a/drivers/usb/misc/sisusbvga/sisusb.c
+++ b/drivers/usb/misc/sisusbvga/sisusb.c
@@ -76,15 +76,11 @@ static void sisusb_free_buffers(struct sisusb_usb_data *sisusb)
 	int i;
 
 	for (i = 0; i < NUMOBUFS; i++) {
-		if (sisusb->obuf[i]) {
-			kfree(sisusb->obuf[i]);
-			sisusb->obuf[i] = NULL;
-		}
-	}
-	if (sisusb->ibuf) {
-		kfree(sisusb->ibuf);
-		sisusb->ibuf = NULL;
+		kfree(sisusb->obuf[i]);
+		sisusb->obuf[i] = NULL;
 	}
+	kfree(sisusb->ibuf);
+	sisusb->ibuf = NULL;
 }
 
 static void sisusb_free_urbs(struct sisusb_usb_data *sisusb)
-- 
2.5.0

  parent reply	other threads:[~2016-01-15 17:42 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 ` [PATCH V2 4/7] usb-misc: sisusbvga: Fix coding style: remove assignment from if tests Peter Senna Tschudin
2016-01-15 17:41 ` Peter Senna Tschudin [this message]
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-6-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