diff mbox

scsi: qedf: Cleanup the type of io_log->op

Message ID 20170503212357.cdl4e43ihpyzl2w6@mwanda (mailing list archive)
State Accepted, archived
Headers show

Commit Message

Dan Carpenter May 3, 2017, 9:23 p.m. UTC
We store sc_cmd->cmnd[0] which is an unsigned char in io_log->op so
this should also be unsigned char.  The other thing is that this is
displayed in the debugfs:

	seq_printf(s, "0x%02x:", io_log->op);

Smatch complains that the formatting won't work for negative values so
changing it to unsigned silences that warning as well.

Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>

Comments

Dupuis, Chad May 4, 2017, 3:07 p.m. UTC | #1
On Wed, 3 May 2017, 5:23pm, Dan Carpenter wrote:

> We store sc_cmd->cmnd[0] which is an unsigned char in io_log->op so
> this should also be unsigned char.  The other thing is that this is
> displayed in the debugfs:
> 
> 	seq_printf(s, "0x%02x:", io_log->op);
> 
> Smatch complains that the formatting won't work for negative values so
> changing it to unsigned silences that warning as well.
> 
> Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
> 
> diff --git a/drivers/scsi/qedf/qedf.h b/drivers/scsi/qedf/qedf.h
> index 40aeb6bb96a2..07ee88200e91 100644
> --- a/drivers/scsi/qedf/qedf.h
> +++ b/drivers/scsi/qedf/qedf.h
> @@ -259,7 +259,7 @@ struct qedf_io_log {
>  	uint16_t task_id;
>  	uint32_t port_id; /* Remote port fabric ID */
>  	int lun;
> -	char op; /* SCSI CDB */
> +	unsigned char op; /* SCSI CDB */
>  	uint8_t lba[4];
>  	unsigned int bufflen; /* SCSI buffer length */
>  	unsigned int sg_count; /* Number of SG elements */
> 

Makes sense.

Acked-by: Chad Dupuis <chad.dupuis@cavium.com>
Martin K. Petersen May 9, 2017, 1:52 a.m. UTC | #2
Dan,

> We store sc_cmd->cmnd[0] which is an unsigned char in io_log->op so
> this should also be unsigned char.  The other thing is that this is
> displayed in the debugfs:

Applied to 4.12/scsi-fixes, thanks!
diff mbox

Patch

diff --git a/drivers/scsi/qedf/qedf.h b/drivers/scsi/qedf/qedf.h
index 40aeb6bb96a2..07ee88200e91 100644
--- a/drivers/scsi/qedf/qedf.h
+++ b/drivers/scsi/qedf/qedf.h
@@ -259,7 +259,7 @@  struct qedf_io_log {
 	uint16_t task_id;
 	uint32_t port_id; /* Remote port fabric ID */
 	int lun;
-	char op; /* SCSI CDB */
+	unsigned char op; /* SCSI CDB */
 	uint8_t lba[4];
 	unsigned int bufflen; /* SCSI buffer length */
 	unsigned int sg_count; /* Number of SG elements */