Re: ultrastor.c is a bit-rot

From: James Bottomley
Date: Mon Mar 17 2008 - 13:25:59 EST


On Mon, 2008-03-17 at 19:01 +0200, Boaz Harrosh wrote:
> In Hebrew we say: "You make me drink Kerosene".

SlÃinte mhath as we say in English.

> An "obvious enough to apply the best straight line fix" submitted below:
>
> I say dump it, it's unused.
>
> Boaz
> ---
> From: Boaz Harrosh <bharrosh@xxxxxxxxxxx>
> Date: Mon, 17 Mar 2008 18:40:03 +0200
> Subject: [PATCH] ultrastor: Fix for ISA DMA allocation
>
> "obvious enough to apply the best straight line fix" submitted
> below.
>
> Signed-off-by: Boaz Harrosh <bharrosh@xxxxxxxxxxx>
> CC: Andi Kleen <ak@xxxxxxx>
> ---
> drivers/scsi/ultrastor.c | 24 +++++++++++++++++++++---
> 1 files changed, 21 insertions(+), 3 deletions(-)
>
> diff --git a/drivers/scsi/ultrastor.c b/drivers/scsi/ultrastor.c
> index f385dce..04441eb 100644
> --- a/drivers/scsi/ultrastor.c
> +++ b/drivers/scsi/ultrastor.c
> @@ -255,8 +255,9 @@ static struct ultrastor_config
> unsigned long mscp_free;
> #endif
> volatile unsigned char aborted[ULTRASTOR_MAX_CMDS];
> - struct mscp mscp[ULTRASTOR_MAX_CMDS];
> -} config = {0};
> + struct mscp *mscp;
> + dma_addr_t dma;
> +} config;
>
> /* Set this to 1 to reset the SCSI bus on error. */
> static int ultrastor_bus_reset;
> @@ -646,12 +647,29 @@ static int ultrastor_24f_detect(struct scsi_host_template * tpnt)
>
> static int ultrastor_detect(struct scsi_host_template * tpnt)
> {
> + int ret;
> +
> tpnt->proc_name = "ultrastor";
> - return ultrastor_14f_detect(tpnt) || ultrastor_24f_detect(tpnt);
> +
> + if (!config.mscp)
> + config.mscp = dma_alloc_coherent(NULL,
> + sizeof(*config.mscp) * ULTRASTOR_MAX_CMDS,
> + &config.dma, GFP_KERNEL);

Error handling here, I'm afraid; dma_alloc_coherent can return NULL.

Other than that, looks great.

James


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