From patchwork Wed May 17 13:00:08 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Maurizio Lombardi X-Patchwork-Id: 9731073 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 6712F602DB for ; Wed, 17 May 2017 13:00:19 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 4F615287AA for ; Wed, 17 May 2017 13:00:19 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 4CD3E287E9; Wed, 17 May 2017 13:00:19 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.9 required=2.0 tests=BAYES_00,RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 8E141287AA for ; Wed, 17 May 2017 13:00:14 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754237AbdEQNAN (ORCPT ); Wed, 17 May 2017 09:00:13 -0400 Received: from mx1.redhat.com ([209.132.183.28]:34050 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754059AbdEQNAM (ORCPT ); Wed, 17 May 2017 09:00:12 -0400 Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 3B4B1C01C700; Wed, 17 May 2017 13:00:11 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mx1.redhat.com 3B4B1C01C700 Authentication-Results: ext-mx08.extmail.prod.ext.phx2.redhat.com; dmarc=none (p=none dis=none) header.from=redhat.com Authentication-Results: ext-mx08.extmail.prod.ext.phx2.redhat.com; spf=pass smtp.mailfrom=mlombard@redhat.com DKIM-Filter: OpenDKIM Filter v2.11.0 mx1.redhat.com 3B4B1C01C700 Received: from manaslu.brq.redhat.com (dhcp-27-224.brq.redhat.com [10.34.27.224]) by smtp.corp.redhat.com (Postfix) with ESMTP id 4330E7F465; Wed, 17 May 2017 13:00:09 +0000 (UTC) From: Maurizio Lombardi To: linux-scsi@vger.kernel.org Cc: jejb@linux.vnet.ibm.com, martin.petersen@oracle.com Subject: [PATCH] ses: fix error message in ses_intf_add() Date: Wed, 17 May 2017 15:00:08 +0200 Message-Id: <1495026008-25704-1-git-send-email-mlombard@redhat.com> X-Scanned-By: MIMEDefang 2.79 on 10.5.11.11 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.32]); Wed, 17 May 2017 13:00:11 +0000 (UTC) Sender: linux-scsi-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-scsi@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP The "result" variable contains a negative error code and should not be logged as an hex value. This fixes the following error message: [ 250.068869] scsi 8:0:2:254: Wrong diagnostic page; asked for 2 got 0 [ 250.068872] scsi 8:0:2:254: Failed to get diagnostic page 0xffffffea Signed-off-by: Maurizio Lombardi Reviewed-by: Ewan D. Milne --- drivers/scsi/ses.c | 21 +++++++++++++-------- 1 file changed, 13 insertions(+), 8 deletions(-) diff --git a/drivers/scsi/ses.c b/drivers/scsi/ses.c index f1cdf32..0ac45be 100644 --- a/drivers/scsi/ses.c +++ b/drivers/scsi/ses.c @@ -604,6 +604,7 @@ static int ses_intf_add(struct device *cdev, unsigned char *buf = NULL, *hdr_buf, *type_ptr; struct ses_device *ses_dev; u32 result; + int page; int i, types, len, components = 0; int err = -ENOMEM; int num_enclosures; @@ -630,7 +631,8 @@ static int ses_intf_add(struct device *cdev, if (!hdr_buf || !ses_dev) goto err_init_free; - result = ses_recv_diag(sdev, 1, hdr_buf, INIT_ALLOC_SIZE); + page = 1; + result = ses_recv_diag(sdev, page, hdr_buf, INIT_ALLOC_SIZE); if (result) goto recv_failed; @@ -639,7 +641,7 @@ static int ses_intf_add(struct device *cdev, if (!buf) goto err_free; - result = ses_recv_diag(sdev, 1, buf, len); + result = ses_recv_diag(sdev, page, buf, len); if (result) goto recv_failed; @@ -669,7 +671,8 @@ static int ses_intf_add(struct device *cdev, ses_dev->page1_len = len; buf = NULL; - result = ses_recv_diag(sdev, 2, hdr_buf, INIT_ALLOC_SIZE); + page = 2; + result = ses_recv_diag(sdev, page, hdr_buf, INIT_ALLOC_SIZE); if (result) goto recv_failed; @@ -679,7 +682,7 @@ static int ses_intf_add(struct device *cdev, goto err_free; /* make sure getting page 2 actually works */ - result = ses_recv_diag(sdev, 2, buf, len); + result = ses_recv_diag(sdev, page, buf, len); if (result) goto recv_failed; ses_dev->page2 = buf; @@ -688,7 +691,8 @@ static int ses_intf_add(struct device *cdev, /* The additional information page --- allows us * to match up the devices */ - result = ses_recv_diag(sdev, 10, hdr_buf, INIT_ALLOC_SIZE); + page = 10; + result = ses_recv_diag(sdev, page, hdr_buf, INIT_ALLOC_SIZE); if (!result) { len = (hdr_buf[2] << 8) + hdr_buf[3] + 4; @@ -696,7 +700,7 @@ static int ses_intf_add(struct device *cdev, if (!buf) goto err_free; - result = ses_recv_diag(sdev, 10, buf, len); + result = ses_recv_diag(sdev, page, buf, len); if (result) goto recv_failed; ses_dev->page10 = buf; @@ -733,8 +737,9 @@ static int ses_intf_add(struct device *cdev, return 0; recv_failed: - sdev_printk(KERN_ERR, sdev, "Failed to get diagnostic page 0x%x\n", - result); + sdev_printk(KERN_ERR, sdev, + "Failed to get diagnostic page %d with error %d\n", + page, result); err = -ENODEV; err_free: kfree(buf);