Re: [PATCH] scsi/osst.c: remove unncessary casting of kmalloc.

From: Stefan Richter
Date: Sat Jan 16 2010 - 10:36:15 EST


Thiago Farina wrote:
> --- a/drivers/scsi/osst.c
> +++ b/drivers/scsi/osst.c
> @@ -5842,9 +5842,8 @@ static int osst_probe(struct device *dev)
> /* if this is the first attach, build the infrastructure */
> write_lock(&os_scsi_tapes_lock);
> if (os_scsi_tapes == NULL) {
> - os_scsi_tapes =
> - (struct osst_tape **)kmalloc(osst_max_dev * sizeof(struct osst_tape *),
> - GFP_ATOMIC);
> + os_scsi_tapes = kmalloc(osst_max_dev * sizeof(struct osst_tape *),
> + GFP_ATOMIC);
> if (os_scsi_tapes == NULL) {
> write_unlock(&os_scsi_tapes_lock);
> printk(KERN_ERR "osst :E: Unable to allocate array for OnStream SCSI tapes.\n");

Since you update the style of this kmalloc usage, you could at the same
time change the sizeof expression to sizeof(* os_scsi_tapes).

There is a lot more that could be renovated around os_scsi_tapes, and
osst in general (GFP_ATOMIC allocations in a device probe? Fixed
maximum number of devices? BKL usage?), but whether it'd be worth the
effort I don't know.
--
Stefan Richter
-=====-==-=- ---= =----
http://arcgraph.de/sr/
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/