From: Mike Anderson <andmike@us.ibm.com>
To: Andries Brouwer <aebr@win.tue.nl>
Cc: Christoph Hellwig <hch@infradead.org>, linux-scsi@vger.kernel.org
Subject: Re: [RFC][PATCH] 2.5 hosts.c and scsi_host list cleanup
Date: Wed, 4 Sep 2002 22:45:52 -0700 [thread overview]
Message-ID: <20020905054552.GC1386@beaverton.ibm.com> (raw)
In-Reply-To: <20020904232624.GA10227@win.tue.nl>
Andries Brouwer [aebr@win.tue.nl] wrote:
> On Thu, Sep 05, 2002 at 12:01:58AM +0100, Christoph Hellwig wrote:
>
> + shost_name = (Scsi_Host_Name *) kmalloc(sizeof(Scsi_Host_Name),
> + GFP_KERNEL);
>
> Cast isn't really needed again.
>
>
> It is true that the cast is not needed, but it belongs to the good casts.
> Usually a cast is bad because it disables checks.
> In this case the cast is a good one, it enables checks.
>
> [Indeed, a void * can be assigned to any pointer, so without the cast
> gcc will only check that shost_name is a pointer. With the cast it
> will check that it is a pointer of the right type.
>
> foo = (type *) kmalloc(N*sizeof(type), ...)
>
> is a good coding habit. Of course using sizeof(*foo) is an alternative.]
I switched it to the sizeof(*foo) style. Was this not the style
previously discussed on LKML.
-Mike
--
Michael Anderson
andmike@us.ibm.com
next prev parent reply other threads:[~2002-09-05 5:45 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2002-09-04 20:43 [RFC][PATCH] 2.5 hosts.c and scsi_host list cleanup Mike Anderson
2002-09-04 23:01 ` Christoph Hellwig
2002-09-04 23:26 ` Andries Brouwer
2002-09-05 5:45 ` Mike Anderson [this message]
2002-09-05 5:43 ` Mike Anderson
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=20020905054552.GC1386@beaverton.ibm.com \
--to=andmike@us.ibm.com \
--cc=aebr@win.tue.nl \
--cc=hch@infradead.org \
--cc=linux-scsi@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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox