linux-ppp.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Maninder Singh <maninder1.s@samsung.com>
To: paulus@samba.org, linux-ppp@vger.kernel.org, netdev@vger.kernel.org
Cc: pankaj.m@samsung.com, Maninder Singh <maninder1.s@samsung.com>
Subject: [PATCH 1/1] ppp: remove NULL check before kfree
Date: Wed, 24 Jun 2015 09:51:42 +0000	[thread overview]
Message-ID: <1435138782-48477-1-git-send-email-maninder1.s@samsung.com> (raw)

No need of explicit NULL check before kfree,
removing the same and little coding style changes.

Signed-off-by: Maninder Singh <maninder1.s@samsung.com>
Reviewed-by: Vaneet narang <v.narang@samsung.com>
---
 drivers/net/ppp/ppp_mppe.c |   10 ++++------
 1 file changed, 4 insertions(+), 6 deletions(-)

diff --git a/drivers/net/ppp/ppp_mppe.c b/drivers/net/ppp/ppp_mppe.c
index 05005c6..06f60b1 100644
--- a/drivers/net/ppp/ppp_mppe.c
+++ b/drivers/net/ppp/ppp_mppe.c
@@ -238,12 +238,11 @@ static void *mppe_alloc(unsigned char *options, int optlen)
 	return (void *)state;
 
 	out_free:
-	    if (state->sha1_digest)
 		kfree(state->sha1_digest);
 	    if (state->sha1)
-		crypto_free_hash(state->sha1);
+			crypto_free_hash(state->sha1);
 	    if (state->arc4)
-		crypto_free_blkcipher(state->arc4);
+			crypto_free_blkcipher(state->arc4);
 	    kfree(state);
 	out:
 	return NULL;
@@ -256,12 +255,11 @@ static void mppe_free(void *arg)
 {
 	struct ppp_mppe_state *state = (struct ppp_mppe_state *) arg;
 	if (state) {
-	    if (state->sha1_digest)
 		kfree(state->sha1_digest);
 	    if (state->sha1)
-		crypto_free_hash(state->sha1);
+			crypto_free_hash(state->sha1);
 	    if (state->arc4)
-		crypto_free_blkcipher(state->arc4);
+			crypto_free_blkcipher(state->arc4);
 	    kfree(state);
 	}
 }
-- 
1.7.9.5


             reply	other threads:[~2015-06-24  9:51 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-06-24  9:51 Maninder Singh [this message]
2015-06-24 11:05 ` [PATCH 1/1] ppp: remove NULL check before kfree Maninder Singh

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=1435138782-48477-1-git-send-email-maninder1.s@samsung.com \
    --to=maninder1.s@samsung.com \
    --cc=linux-ppp@vger.kernel.org \
    --cc=netdev@vger.kernel.org \
    --cc=pankaj.m@samsung.com \
    --cc=paulus@samba.org \
    /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;
as well as URLs for NNTP newsgroup(s).