* [PATCH] jbd: Remove redundant NULL check upon kfree()
@ 2010-08-11 13:00 Davidlohr Bueso
2010-08-11 13:06 ` Jiri Kosina
0 siblings, 1 reply; 3+ messages in thread
From: Davidlohr Bueso @ 2010-08-11 13:00 UTC (permalink / raw)
To: Andrew Morton; +Cc: linux-fsdevel, LKML
jbd: Remove redundant NULL check upon kfree().
Signed-off-by: Davidlohr Bueso <dave@gnu.org>
---
fs/jbd/transaction.c | 3 +--
1 files changed, 1 insertions(+), 2 deletions(-)
diff --git a/fs/jbd/transaction.c b/fs/jbd/transaction.c
index 5ae71e7..5e98130 100644
--- a/fs/jbd/transaction.c
+++ b/fs/jbd/transaction.c
@@ -232,8 +232,7 @@ repeat_locked:
lock_map_acquire(&handle->h_lockdep_map);
out:
- if (unlikely(new_transaction)) /* It's usually NULL */
- kfree(new_transaction);
+ kfree(new_transaction);
return ret;
}
--
1.7.0.4
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH] jbd: Remove redundant NULL check upon kfree()
2010-08-11 13:00 [PATCH] jbd: Remove redundant NULL check upon kfree() Davidlohr Bueso
@ 2010-08-11 13:06 ` Jiri Kosina
2010-08-11 13:11 ` Davidlohr Bueso
0 siblings, 1 reply; 3+ messages in thread
From: Jiri Kosina @ 2010-08-11 13:06 UTC (permalink / raw)
To: Davidlohr Bueso; +Cc: Andrew Morton, linux-fsdevel, LKML
On Wed, 11 Aug 2010, Davidlohr Bueso wrote:
> jbd: Remove redundant NULL check upon kfree().
>
> Signed-off-by: Davidlohr Bueso <dave@gnu.org>
> ---
> fs/jbd/transaction.c | 3 +--
> 1 files changed, 1 insertions(+), 2 deletions(-)
>
> diff --git a/fs/jbd/transaction.c b/fs/jbd/transaction.c
> index 5ae71e7..5e98130 100644
> --- a/fs/jbd/transaction.c
> +++ b/fs/jbd/transaction.c
> @@ -232,8 +232,7 @@ repeat_locked:
>
> lock_map_acquire(&handle->h_lockdep_map);
> out:
> - if (unlikely(new_transaction)) /* It's usually NULL */
> - kfree(new_transaction);
> + kfree(new_transaction);
This doesn't seem entirely redundant, as it is optimized (via the
unlikely() hint) for the opposite case than what kfree() is optimized for
(kfree() assumes that the pointer is likely non-NULL, while the code above
assumes that the pointer si likely NULL).
--
Jiri Kosina
SUSE Labs, Novell Inc.
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] jbd: Remove redundant NULL check upon kfree()
2010-08-11 13:06 ` Jiri Kosina
@ 2010-08-11 13:11 ` Davidlohr Bueso
0 siblings, 0 replies; 3+ messages in thread
From: Davidlohr Bueso @ 2010-08-11 13:11 UTC (permalink / raw)
To: Jiri Kosina; +Cc: Andrew Morton, linux-fsdevel, LKML
On Wed, 2010-08-11 at 15:06 +0200, Jiri Kosina wrote:
> On Wed, 11 Aug 2010, Davidlohr Bueso wrote:
>
> > jbd: Remove redundant NULL check upon kfree().
> >
> > Signed-off-by: Davidlohr Bueso <dave@gnu.org>
> > ---
> > fs/jbd/transaction.c | 3 +--
> > 1 files changed, 1 insertions(+), 2 deletions(-)
> >
> > diff --git a/fs/jbd/transaction.c b/fs/jbd/transaction.c
> > index 5ae71e7..5e98130 100644
> > --- a/fs/jbd/transaction.c
> > +++ b/fs/jbd/transaction.c
> > @@ -232,8 +232,7 @@ repeat_locked:
> >
> > lock_map_acquire(&handle->h_lockdep_map);
> > out:
> > - if (unlikely(new_transaction)) /* It's usually NULL */
> > - kfree(new_transaction);
> > + kfree(new_transaction);
>
> This doesn't seem entirely redundant, as it is optimized (via the
> unlikely() hint) for the opposite case than what kfree() is optimized for
> (kfree() assumes that the pointer is likely non-NULL, while the code above
> assumes that the pointer si likely NULL).
>
Ok, makes sense. I was a bit doubtful about the unlikely(), thanks for
the review.
Davidlohr
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2010-08-11 13:11 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2010-08-11 13:00 [PATCH] jbd: Remove redundant NULL check upon kfree() Davidlohr Bueso
2010-08-11 13:06 ` Jiri Kosina
2010-08-11 13:11 ` Davidlohr Bueso
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.