On Wed, 11 May 2005, Alexey Dobriyan wrote:
> On Wednesday 11 May 2005 00:06, Jesper Juhl wrote:
> > It doesn't make sense to cast NULL. This patch removes the pointless casts
> > from drivers/atm/nicstar.c
>
> > --- linux-2.6.12-rc3-mm3-orig/drivers/atm/nicstar.c
> > +++ linux-2.6.12-rc3-mm3/drivers/atm/nicstar.c
>
> > scq = (scq_info *) kmalloc(sizeof(scq_info), GFP_KERNEL);
> ^^^^^^^^^^^^
> > - if (scq == (scq_info *) NULL)
> > - return (scq_info *) NULL;
> > + if (scq == NULL)
> > + return NULL;
>
> > scq->skb = (struct sk_buff **) kmalloc(sizeof(struct sk_buff *) *
> ^^^^^^^^^^^^^^^^^^^
> > (size / NS_SCQE_SIZE), GFP_KERNEL);
> > - if (scq->skb == (struct sk_buff **) NULL)
> > + if (scq->skb == NULL)
>
> These are pointless too.
>
True, but I wanted the patch to only do a single well defined thing. I was
not 100% sure what the reaction to such a patch would be, so I didn't want
to mix other things in as well... Actually, thinking about it a bit; will
gcc ever generate different code for NULL pointers cast to different
types? As far as I know it won't, but if it will, then the casts could
actually make sense.
I can submit a second patch to remove the casts of kmalloc return values if
wanted.
--
Jesper
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
[Index of Archives]
[Kernel Newbies]
[Netfilter]
[Bugtraq]
[Photo]
[Stuff]
[Gimp]
[Yosemite News]
[MIPS Linux]
[ARM Linux]
[Linux Security]
[Linux RAID]
[Video 4 Linux]
[Linux for the blind]
[Linux Resources]