Re: [PATCH 3/7] sbp-target: Consolidate duplicated error path code in sbp_handle_command()

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

 



On Mon, 2012-07-16 at 11:04 -0700, Roland Dreier wrote:
> From: Roland Dreier <roland@xxxxxxxxxxxxxxx>
> 
> Cc: Chris Boot <bootc@xxxxxxxxx>
> Cc: Stefan Richter <stefanr@xxxxxxxxxxxxxxxxx>
> Signed-off-by: Roland Dreier <roland@xxxxxxxxxxxxxxx>
> ---
>  drivers/target/sbp/sbp_target.c |   28 ++++++++++++----------------
>  1 file changed, 12 insertions(+), 16 deletions(-)
> 

Looks like a reasonable 'de-dupe'.  Applied to for-next.

> diff --git a/drivers/target/sbp/sbp_target.c b/drivers/target/sbp/sbp_target.c
> index 7e6136e..2425ca4 100644
> --- a/drivers/target/sbp/sbp_target.c
> +++ b/drivers/target/sbp/sbp_target.c
> @@ -1219,28 +1219,14 @@ static void sbp_handle_command(struct sbp_target_request *req)
>  	ret = sbp_fetch_command(req);
>  	if (ret) {
>  		pr_debug("sbp_handle_command: fetch command failed: %d\n", ret);
> -		req->status.status |= cpu_to_be32(
> -			STATUS_BLOCK_RESP(STATUS_RESP_TRANSPORT_FAILURE) |
> -			STATUS_BLOCK_DEAD(0) |
> -			STATUS_BLOCK_LEN(1) |
> -			STATUS_BLOCK_SBP_STATUS(SBP_STATUS_UNSPECIFIED_ERROR));
> -		sbp_send_status(req);
> -		sbp_free_request(req);
> -		return;
> +		goto err;
>  	}
>  
>  	ret = sbp_fetch_page_table(req);
>  	if (ret) {
>  		pr_debug("sbp_handle_command: fetch page table failed: %d\n",
>  			ret);
> -		req->status.status |= cpu_to_be32(
> -			STATUS_BLOCK_RESP(STATUS_RESP_TRANSPORT_FAILURE) |
> -			STATUS_BLOCK_DEAD(0) |
> -			STATUS_BLOCK_LEN(1) |
> -			STATUS_BLOCK_SBP_STATUS(SBP_STATUS_UNSPECIFIED_ERROR));
> -		sbp_send_status(req);
> -		sbp_free_request(req);
> -		return;
> +		goto err;
>  	}
>  
>  	unpacked_lun = req->login->lun->unpacked_lun;
> @@ -1252,6 +1238,16 @@ static void sbp_handle_command(struct sbp_target_request *req)
>  	target_submit_cmd(&req->se_cmd, sess->se_sess, req->cmd_buf,
>  			req->sense_buf, unpacked_lun, data_length,
>  			MSG_SIMPLE_TAG, data_dir, 0);
> +	return;
> +
> +err:
> +	req->status.status |= cpu_to_be32(
> +		STATUS_BLOCK_RESP(STATUS_RESP_TRANSPORT_FAILURE) |
> +		STATUS_BLOCK_DEAD(0) |
> +		STATUS_BLOCK_LEN(1) |
> +		STATUS_BLOCK_SBP_STATUS(SBP_STATUS_UNSPECIFIED_ERROR));
> +	sbp_send_status(req);
> +	sbp_free_request(req);
>  }
>  
>  /*


--
To unsubscribe from this list: send the line "unsubscribe linux-scsi" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [SCSI Target Devel]     [Linux SCSI Target Infrastructure]     [Kernel Newbies]     [IDE]     [Security]     [Git]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux ATA RAID]     [Linux IIO]     [Samba]     [Device Mapper]
  Powered by Linux