jbd: Remove redundant NULL check upon kfree().
Signed-off-by: Davidlohr Bueso <[email protected]>
---
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
On Wed, 11 Aug 2010, Davidlohr Bueso wrote:
> jbd: Remove redundant NULL check upon kfree().
>
> Signed-off-by: Davidlohr Bueso <[email protected]>
> ---
> 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.
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 <[email protected]>
> > ---
> > 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