From: Paul Mundt <lethal@linux-sh.org>
To: Andr? Lopes <andre.neo.net@gmail.com>
Cc: kernel-janitors@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: Are the cast necessary in function "kfree"?
Date: Wed, 20 May 2009 11:16:51 +0000 [thread overview]
Message-ID: <20090520111650.GA11557@linux-sh.org> (raw)
In-Reply-To: <5c43c2d40905200330p5b14be2ey567bc493374e09b3@mail.gmail.com>
On Wed, May 20, 2009 at 11:30:21AM +0100, Andr? Lopes wrote:
> Hi. This is my first post :-)
>
> I was reading this doc (/linux-2.6/Documentation/scsi/ChangeLog.lpfc),
> when I found this phrase: "Replace some kfree((void*)ptr) with
> kfree(ptr)."
>
[snip]
> These casts are not necessary...I think so. If it's yes, can we apply
> patch's to clean-up this?
>
The key thing here is "ptr", as long as these are pointers, then the cast
is superfluous. In the case of casting from a non-pointer type, the cast
is necessary, particularly if the data type and pointer size vary.
WARNING: multiple messages have this Message-ID (diff)
From: Paul Mundt <lethal@linux-sh.org>
To: Andr? Lopes <andre.neo.net@gmail.com>
Cc: kernel-janitors@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: Are the cast necessary in function "kfree"?
Date: Wed, 20 May 2009 20:16:51 +0900 [thread overview]
Message-ID: <20090520111650.GA11557@linux-sh.org> (raw)
In-Reply-To: <5c43c2d40905200330p5b14be2ey567bc493374e09b3@mail.gmail.com>
On Wed, May 20, 2009 at 11:30:21AM +0100, Andr? Lopes wrote:
> Hi. This is my first post :-)
>
> I was reading this doc (/linux-2.6/Documentation/scsi/ChangeLog.lpfc),
> when I found this phrase: "Replace some kfree((void*)ptr) with
> kfree(ptr)."
>
[snip]
> These casts are not necessary...I think so. If it's yes, can we apply
> patch's to clean-up this?
>
The key thing here is "ptr", as long as these are pointers, then the cast
is superfluous. In the case of casting from a non-pointer type, the cast
is necessary, particularly if the data type and pointer size vary.
next prev parent reply other threads:[~2009-05-20 11:16 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-05-20 10:30 Are the cast necessary in function "kfree"? André Lopes
2009-05-20 10:30 ` André Lopes
2009-05-20 10:38 ` Christian Bornträger
2009-05-20 10:38 ` Christian Bornträger
2009-05-20 11:16 ` Paul Mundt [this message]
2009-05-20 11:16 ` Paul Mundt
2009-05-20 12:18 ` walter harms
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=20090520111650.GA11557@linux-sh.org \
--to=lethal@linux-sh.org \
--cc=andre.neo.net@gmail.com \
--cc=kernel-janitors@vger.kernel.org \
--cc=linux-kernel@vger.kernel.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 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.