Re: [PATCH] sd.c: handling resource allocation failure

From: Arnaldo Carvalho de Melo (acme@conectiva.com.br)
Date: Wed Aug 23 2000 - 10:24:44 EST


Em Wed, Aug 23, 2000 at 07:15:40PM +0100, Tigran Aivazian escreveu:
> On Wed, 23 Aug 2000, Arnaldo Carvalho de Melo wrote:
> > -static struct gendisk *sd_gendisks = &sd_gendisk;
> > +static struct gendisk *sd_gendisks = NULL;
>
> no need to set things to NULL, BSS is zero-cleared by the kernel on

good, fixing.

> boot. See the code in arch/i386/kernel/head.S (look for surprises)
>
> > rscsi_disks = (Scsi_Disk *)
> > kmalloc(sd_template.dev_max * sizeof(Scsi_Disk), GFP_ATOMIC);
>
> no need to cast return from kmalloc, it returns (void *) and typecasts are
> tiresome to eyes (human eyes, i.e.).

I was trying to keep my patch as small as possible, changing just the needed
parts, yes, I agree, no need for casts

> > sd_hardsizes = (int *) kmalloc((sd_template.dev_max << 4) * sizeof(int), GFP_ATOMIC);
>
> same here and elsewhere, I know, it's not yours but while you are there,
> please clean up.

yap, I'll do it now. thanks for your quick feedback!

- Arnaldo
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
Please read the FAQ at http://www.tux.org/lkml/



This archive was generated by hypermail 2b29 : Wed Aug 23 2000 - 21:00:09 EST