From: "Abdul, Hussain (H.)" <habdul@visteon.com>
To: "gregkh@linuxfoundation.org" <gregkh@linuxfoundation.org>
Cc: "johnny.kim@atmel.com" <johnny.kim@atmel.com>,
"rachel.kim@atmel.com" <rachel.kim@atmel.com>,
"dean.lee@atmel.com" <dean.lee@atmel.com>,
"chris.park@atmel.com" <chris.park@atmel.com>,
"linux-wireless@vger.kernel.org" <linux-wireless@vger.kernel.org>,
"devel@driverdev.osuosl.org" <devel@driverdev.osuosl.org>,
"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
"mravind@visteon.com" <mravind@visteon.com>,
"Dighe, Niranjan (N.)" <ndighe@visteon.com>
Subject: [PATCH] Staging: wilc1000: NULL check before some freeing functions is not needed
Date: Thu, 18 Jun 2015 12:37:00 +0000 [thread overview]
Message-ID: <1434630935-4526-1-git-send-email-habdul@visteon.com> (raw)
From: Abdul Hussain <habdul@visteon.com>
This patch removes check before freeing the memory
since kfree(NULL) is safe
Signed-off-by: Abdul Hussain <habdul@visteon.com>
---
drivers/staging/wilc1000/linux_wlan_spi.c | 6 ++----
1 file changed, 2 insertions(+), 4 deletions(-)
diff --git a/drivers/staging/wilc1000/linux_wlan_spi.c b/drivers/staging/wilc1000/linux_wlan_spi.c
index 1eee1d5..236669c 100644
--- a/drivers/staging/wilc1000/linux_wlan_spi.c
+++ b/drivers/staging/wilc1000/linux_wlan_spi.c
@@ -214,8 +214,7 @@ int linux_spi_write(uint8_t *b, uint32_t len)
PRINT_ER("SPI transaction failed\n");
}
}
- if (r_buffer)
- kfree(r_buffer);
+ kfree(r_buffer);
} else {
PRINT_ER("can't write data with the following length: %d\n", len);
PRINT_ER("FAILED due to NULL buffer or ZERO length check the following length: %d\n", len);
@@ -377,8 +376,7 @@ int linux_spi_read(unsigned char *rb, unsigned long rlen)
}
}
- if (t_buffer)
- kfree(t_buffer);
+ kfree(t_buffer);
} else {
PRINT_ER("can't read data with the following length: %ld\n", rlen);
ret = -1;
--
1.9.1
reply other threads:[~2015-06-18 12:37 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
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=1434630935-4526-1-git-send-email-habdul@visteon.com \
--to=habdul@visteon.com \
--cc=chris.park@atmel.com \
--cc=dean.lee@atmel.com \
--cc=devel@driverdev.osuosl.org \
--cc=gregkh@linuxfoundation.org \
--cc=johnny.kim@atmel.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-wireless@vger.kernel.org \
--cc=mravind@visteon.com \
--cc=ndighe@visteon.com \
--cc=rachel.kim@atmel.com \
/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
all inboxes | Powered by JetHome®