qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Qemu-devel] Re: [PATCH 14/15] megasas: LSI Megaraid SAS emulation


From: Stefan Hajnoczi
Subject: [Qemu-devel] Re: [PATCH 14/15] megasas: LSI Megaraid SAS emulation
Date: Thu, 25 Nov 2010 14:36:08 +0000

On Wed, Nov 24, 2010 at 11:16 AM, Hannes Reinecke <address@hidden> wrote:
> +static int megasas_pd_get_info_submit(SCSIDevice * sdev, int lun,
> +                                      struct megasas_cmd_t *cmd)
> +{
> +    struct mfi_pd_info * info = cmd->iov_buf;
> +    uint8_t cmdbuf[6];
> +    SCSIRequest *req;
> +
> +    if (info->inquiry_data[4] == 0) {
> +        /* Additional length is zero, resubmit */
> +        megasas_setup_inquiry(cmdbuf, 0, info->inquiry_data,
> +                              sizeof(info->inquiry_data));
> +        req = sdev->info->alloc_req(sdev, (uint32_t) -1, lun);
> +        if (!req) {
> +            return MFI_STAT_FLASH_ALLOC_FAIL;
> +        }
> +        DPRINTF_DCMD("PD get info submit std inquiry to dev %d\n", lun);
> +        req->hba_private = cmd;
> +        if (cmd->sdev->info->send_command(req, cmdbuf) > 0)
> +            cmd->sdev->info->read_data(req);
> +        return MFI_STAT_INVALID_STATUS;

Here...

> +    } else if (info->vpd_page83[3] == 0) {
> +        /* Additional length is zero, resubmit */
> +        megasas_setup_inquiry(cmdbuf, 0x83,(uint8_t *)info->vpd_page83,
> +                              sizeof(info->vpd_page83));
> +        req = sdev->info->alloc_req(sdev, (uint32_t) -1, lun);
> +        if (!req) {
> +            return MFI_STAT_FLASH_ALLOC_FAIL;
> +        }
> +        DPRINTF_DCMD("PD get info submit vpd inquiry to dev %d\n", lun);
> +        req->hba_private = cmd;
> +        if (cmd->sdev->info->send_command(req, cmdbuf) > 0)
> +            cmd->sdev->info->read_data(req);
> +        return MFI_STAT_INVALID_STATUS;

...and here I can't tell for sure if an error status is returned
intentionally or whether this is an if statement without {}-related
bug.

On one hand it looks like it could be intentional.  On the other hand
we went through the trouble of sending an inquiry command that may
have succeeded but we're still returning an error status.

Stefan



reply via email to

[Prev in Thread] Current Thread [Next in Thread]