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

From: Tigran Aivazian (tigran@veritas.com)
Date: Wed Aug 23 2000 - 13:15:40 EST


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
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.).

> 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.

regards,
Tigran

-
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