Re: [PATCH 1/1] ppp: remove NULL check before kfree

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



>No need of explicit NULL check before kfree,
>removing the same and little coding style changes.
>
>Signed-off-by: Maninder Singh <maninder1.s@xxxxxxxxxxx>
>Reviewed-by: Vaneet narang <v.narang@xxxxxxxxxxx>
>---
> 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
Send V2 of patch with some more changes.
Thanks
Maninder
-------

ÿôèº{.nÇ+‰·Ÿ®‰­†+%ŠËÿ±éݶ¥Šwÿº{.nÇ+‰·¥Š{±þšiþ)í…æèw*jg¬±¨¶‰šŽŠÝ¢jÿ¾«þG«?éÿ¢¸¢·¦j:+v‰¨ŠwèjØm¶Ÿÿþø¯ù®w¥þŠàþf£¢·hš?â?úÿ†Ù¥




[Index of Archives]     [Linux Audio Users]     [Linux for Hams]     [Kernel Newbies]     [Security]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Samba]     [Video 4 Linux]     [Fedora Users]

  Powered by Linux