lkml.org 
[lkml]   [2000]   [Aug]   [23]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH] sd.c: handling resource allocation failure
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/

\
 
 \ /
  Last update: 2005-03-22 12:37    [W:0.078 / U:0.020 seconds]
©2003-2018 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site