ses: fix error message in ses_intf_add()
PATCH 1/1 ses: fix error message in ses_intf_add()
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
--- drivers/scsi/ses.c | 21 +++++++++++++-------- 1 file changed, 13 insertions(+), 8 deletions(-)
drivers/scsi/ses.c +13 -8
@@ -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);
Signature · 1 line
Maurizio Lombardi
Quoted 83 lines · Maurizio Lombardi
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 0xffffffeaSigned-off-by Maurizio Lombardi <[email protected]>--- drivers/scsi/ses.c | 21 +++++++++++++-------- 1 file changed, 13 insertions(+), 8 deletions(-)drivers/scsi/ses.c +10
-6@@ -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 ;
drivers/scsi/ses.c static int ses_intf_add(struct device *cdev, · line 745
Quoted 10 lines
drivers/scsi/ses.c +3
-2recv_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.
Ewan,
Quoted 6 lines
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 agree.
Quoted 1 line
I've received several complaints about this.
Me too. There appears to be a ton of bad devices out there.
Signature · 1 line
Martin K. Petersen Oracle Linux Engineering