On 06/23/2018 12:22 PM, Douglas Gilbert wrote:
Break out several intertwined paths when cmd->result is non zero and place them in the scsi_io_completion_nz_result helper function. The logic is not changed. Signed-off-by: Douglas Gilbert <dgilbert@xxxxxxxxxxxx> Reviewed-by: Johannes Thumshirn <jthumshirn@xxxxxxx> Reviewed-by: Bart Van Assche <bart.vanassche@xxxxxxx> --- A reviewer requested the original helper function's two return values be reduced to one: the blk_stat variable. This required a hack to differentiate the default setting of blk_stat (BLK_STS_OK) from the case when the helper assigns BLK_STS_OK as the return value. The hack was to return the otherwise unused BLK_STS_NOTSUPP value as an indication that the helper didn't change anything. That hack was judged by another reviewer to be worse that the "two return values" ugliness it was trying to address. So back to the original "two return values" solution. drivers/scsi/scsi_lib.c | 132 +++++++++++++++++++++++----------------- 1 file changed, 75 insertions(+), 57 deletions(-)
Still looks ugly, but then it's only a helper function. Reviewed-by: Hannes Reinecke <hare@xxxxxxxx> Cheers, Hannes