Re: [PATCH 6/6] scsi: handle more device handler setup/teardown in common code

From: Mike Christie
Date: Tue Oct 28 2014 - 13:53:20 EST


On 10/19/2014 11:00 AM, Christoph Hellwig wrote:
> -static int rdac_bus_attach(struct scsi_device *sdev)
> +static struct scsi_dh_data *rdac_bus_attach(struct scsi_device *sdev)
> {
> struct rdac_dh_data *h;
> - unsigned long flags;
> int err;
> char array_name[ARRAY_LABEL_LEN];
> char array_id[UNIQUE_ID_LEN];
>
> h = kzalloc(sizeof(*h) , GFP_KERNEL);
> - if (!h) {
> - sdev_printk(KERN_ERR, sdev, "%s: Attach failed\n",
> - RDAC_NAME);
> - return -ENOMEM;
> - }
> -
> - h->dh_data.scsi_dh = &rdac_dh;
> + if (!h)
> + return ERR_PTR(-ENOMEM);
> h->lun = UNINITIALIZED_LUN;
> h->state = RDAC_STATE_ACTIVE;
>
> @@ -876,15 +856,10 @@ static int rdac_bus_attach(struct scsi_device *sdev)
> if (err != SCSI_DH_OK)
> goto clean_ctlr;
>
> - spin_lock_irqsave(sdev->request_queue->queue_lock, flags);
> - sdev->scsi_dh_data = &h->dh_data;
> - spin_unlock_irqrestore(sdev->request_queue->queue_lock, flags);
> -
> sdev_printk(KERN_NOTICE, sdev,
> "%s: LUN %d (%s) (%s)\n",
> RDAC_NAME, h->lun, mode[(int)h->mode],
> lun_state[(int)h->lun_state]);
> -
> return 0;

Was this supposed to return a "struct scsi_dh_data *" instead of zero here?
--
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/