The error code from a scsi_execute_req() is a SCSI status, not a normal errno. So whenever it returns a value here an error occurred and there's no point in looking at the page number. Signed-off-by: Hannes Reinecke <hare@xxxxxxxx> --- drivers/scsi/ses.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/scsi/ses.c b/drivers/scsi/ses.c index f1cdf32..a37aec8 100644 --- a/drivers/scsi/ses.c +++ b/drivers/scsi/ses.c @@ -99,8 +99,8 @@ static int ses_recv_diag(struct scsi_device *sdev, int page_code, ret = scsi_execute_req(sdev, cmd, DMA_FROM_DEVICE, buf, bufflen, NULL, SES_TIMEOUT, SES_RETRIES, NULL); - if (unlikely(!ret)) - return ret; + if (unlikely(ret)) + return -EIO; recv_page_code = ((unsigned char *)buf)[0]; -- 1.8.5.6