public inbox for linux-scsi@vger.kernel.org
 help / color / mirror / Atom feed
From: "Ewan D. Milne" <emilne@redhat.com>
To: Maurizio Lombardi <mlombard@redhat.com>
Cc: linux-scsi@vger.kernel.org, jejb@linux.vnet.ibm.com,
	martin.petersen@oracle.com
Subject: Re: [PATCH] ses: fix error message in ses_intf_add()
Date: Wed, 17 May 2017 09:41:26 -0400	[thread overview]
Message-ID: <1495028486.3629.10.camel@localhost.localdomain> (raw)
In-Reply-To: <1495026008-25704-1-git-send-email-mlombard@redhat.com>

On Wed, 2017-05-17 at 15:00 +0200, Maurizio Lombardi wrote:
> 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 <mlombard@redhat.com>
> ---
>  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);

This looks OK but I think we should consider suppressing these
messages.  There are a lot of devices that return page 0 instead of
the correct page, we should either say something like "enclosure
services not supported", or else work with what we get instead of
logging a message on every device probe that make it sound like
the device is failing.  I've received several complaints about this.

Reviewed-by: Ewan D. Milne <emilne@redhat.com>

  reply	other threads:[~2017-05-17 13:41 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-05-17 13:00 [PATCH] ses: fix error message in ses_intf_add() Maurizio Lombardi
2017-05-17 13:41 ` Ewan D. Milne [this message]
2017-05-18  0:18   ` Martin K. Petersen

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1495028486.3629.10.camel@localhost.localdomain \
    --to=emilne@redhat.com \
    --cc=jejb@linux.vnet.ibm.com \
    --cc=linux-scsi@vger.kernel.org \
    --cc=martin.petersen@oracle.com \
    --cc=mlombard@redhat.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox