mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Jesper Juhl <juhl-lkml@dif.dk>
To: "David S. Miller" <davem@davemloft.net>
Cc: Laurence Culhane <loz@holmes.demon.co.uk>,
	linux-serial@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH] SLIP: simplify sl_free_bufs
Date: Thu, 23 Jun 2005 22:46:06 +0200 (CEST)	[thread overview]
Message-ID: <Pine.LNX.4.62.0506232243340.7467@dragon.hyggekrogen.localhost> (raw)
In-Reply-To: <Pine.LNX.4.62.0506152136310.3842@dragon.hyggekrogen.localhost>


The patch below still applies cleanly to 2.6.12 - any chance this might 
get applied? or any good reasons not to apply it?

-- Jesper


On Wed, 15 Jun 2005, Jesper Juhl wrote:

> We can avoid assignments to the local variable 'tmp' and 
> actually get rid of tmp alltogether in sl_free_bufs(). This patch does 
> that.  This is safe since both kfree() and slhc_free() handles NULL 
> pointers gracefully.
> 
> A related question: Why the use of NULLSLCOMPR & NULLSLSTATE instead of 
> plain NULL for struct slcompress and its members?
> They are defined as 
> 	#define NULLSLCOMPR     (struct slcompress *)0
> 	#define NULLSLSTATE     (struct cstate *)0
> Seems to me that plain NULL might as well be used (and if so I have a few 
> more potential cleanups in the queue).
> 
> 
> Signed-off-by: Jesper Juhl <juhl-lkml@dif.dk>
> ---
> 
>  drivers/net/slip.c |   14 ++++----------
>  1 files changed, 4 insertions(+), 10 deletions(-)
> 
> --- linux-2.6.12-rc6-orig/drivers/net/slip.c	2005-06-07 00:07:22.000000000 +0200
> +++ linux-2.6.12-rc6-mm1/drivers/net/slip.c	2005-06-15 21:39:39.000000000 +0200
> @@ -198,18 +198,12 @@ err_exit:
>  static void
>  sl_free_bufs(struct slip *sl)
>  {
> -	void * tmp;
> -
>  	/* Free all SLIP frame buffers. */
> -	tmp = xchg(&sl->rbuff, NULL);
> -	kfree(tmp);
> -	tmp = xchg(&sl->xbuff, NULL);
> -	kfree(tmp);
> +	kfree(xchg(&sl->rbuff, NULL));
> +	kfree(xchg(&sl->xbuff, NULL));
>  #ifdef SL_INCLUDE_CSLIP
> -	tmp = xchg(&sl->cbuff, NULL);
> -	kfree(tmp);
> -	if ((tmp = xchg(&sl->slcomp, NULL)) != NULL)
> -		slhc_free(tmp);
> +	kfree(xchg(&sl->cbuff, NULL));
> +	slhc_free(xchg(&sl->slcomp, NULL));
>  #endif
>  }
>  
> 
> 
> 
> Please CC me on replies.
> 
> -- 
> Jesper Juhl
> 


  reply	other threads:[~2005-06-23 20:49 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2005-06-15 19:46 Jesper Juhl
2005-06-23 20:46 ` Jesper Juhl [this message]
2005-06-23 21:10   ` David S. Miller
2005-06-23 21:16     ` Jesper Juhl
2005-06-24  4:07   ` David S. Miller

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=Pine.LNX.4.62.0506232243340.7467@dragon.hyggekrogen.localhost \
    --to=juhl-lkml@dif.dk \
    --cc=davem@davemloft.net \
    --cc=jesper.juhl@gmail.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-serial@vger.kernel.org \
    --cc=loz@holmes.demon.co.uk \
    /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®