Commit 539d890c authored by Uma Krishnan's avatar Uma Krishnan Committed by Martin K. Petersen

scsi: cxlflash: Update cxlflash_afu_sync() to return errno

The cxlflash_afu_sync() routine returns a negative one to indicate any kind
of failure. This makes it impossible to establish why the error occurred.

Update the return codes to clearly indicate the failure cause to the
caller.
Signed-off-by: default avatarUma Krishnan <ukrishn@linux.vnet.ibm.com>
Acked-by: default avatarMatthew R. Ochs <mrochs@linux.vnet.ibm.com>
Signed-off-by: default avatarMartin K. Petersen <martin.petersen@oracle.com>
parent 66ea9bcc
...@@ -2022,8 +2022,7 @@ static int init_afu(struct cxlflash_cfg *cfg) ...@@ -2022,8 +2022,7 @@ static int init_afu(struct cxlflash_cfg *cfg)
* going away). * going away).
* *
* Return: * Return:
* 0 on success * 0 on success, -errno on failure
* -1 on failure
*/ */
int cxlflash_afu_sync(struct afu *afu, ctx_hndl_t ctx_hndl_u, int cxlflash_afu_sync(struct afu *afu, ctx_hndl_t ctx_hndl_u,
res_hndl_t res_hndl_u, u8 mode) res_hndl_t res_hndl_u, u8 mode)
...@@ -2047,7 +2046,7 @@ int cxlflash_afu_sync(struct afu *afu, ctx_hndl_t ctx_hndl_u, ...@@ -2047,7 +2046,7 @@ int cxlflash_afu_sync(struct afu *afu, ctx_hndl_t ctx_hndl_u,
buf = kzalloc(sizeof(*cmd) + __alignof__(*cmd) - 1, GFP_KERNEL); buf = kzalloc(sizeof(*cmd) + __alignof__(*cmd) - 1, GFP_KERNEL);
if (unlikely(!buf)) { if (unlikely(!buf)) {
dev_err(dev, "%s: no memory for command\n", __func__); dev_err(dev, "%s: no memory for command\n", __func__);
rc = -1; rc = -ENOMEM;
goto out; goto out;
} }
...@@ -2071,12 +2070,14 @@ int cxlflash_afu_sync(struct afu *afu, ctx_hndl_t ctx_hndl_u, ...@@ -2071,12 +2070,14 @@ int cxlflash_afu_sync(struct afu *afu, ctx_hndl_t ctx_hndl_u,
*((__be32 *)&cmd->rcb.cdb[4]) = cpu_to_be32(res_hndl_u); *((__be32 *)&cmd->rcb.cdb[4]) = cpu_to_be32(res_hndl_u);
rc = afu->send_cmd(afu, cmd); rc = afu->send_cmd(afu, cmd);
if (unlikely(rc)) if (unlikely(rc)) {
rc = -ENOBUFS;
goto out; goto out;
}
rc = wait_resp(afu, cmd); rc = wait_resp(afu, cmd);
if (unlikely(rc)) if (unlikely(rc))
rc = -1; rc = -EIO;
out: out:
atomic_dec(&afu->cmds_active); atomic_dec(&afu->cmds_active);
mutex_unlock(&sync_active); mutex_unlock(&sync_active);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment