linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] scsi: 3w-{sas,9xxx}: Use unsigned char for cdb
@ 2018-10-18 21:55 Nathan Chancellor
  2018-10-19 20:59 ` adam radford
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: Nathan Chancellor @ 2018-10-18 21:55 UTC (permalink / raw)
  To: Adam Radford, James E.J. Bottomley, Martin K. Petersen
  Cc: linux-scsi, linux-kernel, Nathan Chancellor

Clang warns a few times:

drivers/scsi/3w-sas.c:386:11: warning: implicit conversion from 'int' to
'char' changes value from 128 to -128 [-Wconstant-conversion]
        cdb[4] = TW_ALLOCATION_LENGTH; /* allocation length */
               ~ ^~~~~~~~~~~~~~~~~~~~

Update cdb's type to unsigned char, which matches the type of the cdb
member in struct TW_Command_Apache.

Link: https://github.com/ClangBuiltLinux/linux/issues/158
Signed-off-by: Nathan Chancellor <natechancellor@gmail.com>
---
 drivers/scsi/3w-9xxx.c | 12 ++++++++----
 drivers/scsi/3w-sas.c  |  8 +++++---
 2 files changed, 13 insertions(+), 7 deletions(-)

diff --git a/drivers/scsi/3w-9xxx.c b/drivers/scsi/3w-9xxx.c
index 05293babb031..2d655a97b959 100644
--- a/drivers/scsi/3w-9xxx.c
+++ b/drivers/scsi/3w-9xxx.c
@@ -143,7 +143,9 @@ static int twa_poll_status_gone(TW_Device_Extension *tw_dev, u32 flag, int secon
 static int twa_post_command_packet(TW_Device_Extension *tw_dev, int request_id, char internal);
 static int twa_reset_device_extension(TW_Device_Extension *tw_dev);
 static int twa_reset_sequence(TW_Device_Extension *tw_dev, int soft_reset);
-static int twa_scsiop_execute_scsi(TW_Device_Extension *tw_dev, int request_id, char *cdb, int use_sg, TW_SG_Entry *sglistarg);
+static int twa_scsiop_execute_scsi(TW_Device_Extension *tw_dev, int request_id,
+				   unsigned char *cdb, int use_sg,
+				   TW_SG_Entry *sglistarg);
 static void twa_scsiop_execute_scsi_complete(TW_Device_Extension *tw_dev, int request_id);
 static char *twa_string_lookup(twa_message_type *table, unsigned int aen_code);
 
@@ -278,7 +280,7 @@ static int twa_aen_complete(TW_Device_Extension *tw_dev, int request_id)
 static int twa_aen_drain_queue(TW_Device_Extension *tw_dev, int no_check_reset)
 {
 	int request_id = 0;
-	char cdb[TW_MAX_CDB_LEN];
+	unsigned char cdb[TW_MAX_CDB_LEN];
 	TW_SG_Entry sglist[1];
 	int finished = 0, count = 0;
 	TW_Command_Full *full_command_packet;
@@ -423,7 +425,7 @@ static void twa_aen_queue_event(TW_Device_Extension *tw_dev, TW_Command_Apache_H
 /* This function will read the aen queue from the isr */
 static int twa_aen_read_queue(TW_Device_Extension *tw_dev, int request_id)
 {
-	char cdb[TW_MAX_CDB_LEN];
+	unsigned char cdb[TW_MAX_CDB_LEN];
 	TW_SG_Entry sglist[1];
 	TW_Command_Full *full_command_packet;
 	int retval = 1;
@@ -1798,7 +1800,9 @@ static int twa_scsi_queue_lck(struct scsi_cmnd *SCpnt, void (*done)(struct scsi_
 static DEF_SCSI_QCMD(twa_scsi_queue)
 
 /* This function hands scsi cdb's to the firmware */
-static int twa_scsiop_execute_scsi(TW_Device_Extension *tw_dev, int request_id, char *cdb, int use_sg, TW_SG_Entry *sglistarg)
+static int twa_scsiop_execute_scsi(TW_Device_Extension *tw_dev, int request_id,
+				   unsigned char *cdb, int use_sg,
+				   TW_SG_Entry *sglistarg)
 {
 	TW_Command_Full *full_command_packet;
 	TW_Command_Apache *command_packet;
diff --git a/drivers/scsi/3w-sas.c b/drivers/scsi/3w-sas.c
index 266bdac75304..480cf82700e9 100644
--- a/drivers/scsi/3w-sas.c
+++ b/drivers/scsi/3w-sas.c
@@ -287,7 +287,9 @@ static int twl_post_command_packet(TW_Device_Extension *tw_dev, int request_id)
 } /* End twl_post_command_packet() */
 
 /* This function hands scsi cdb's to the firmware */
-static int twl_scsiop_execute_scsi(TW_Device_Extension *tw_dev, int request_id, char *cdb, int use_sg, TW_SG_Entry_ISO *sglistarg)
+static int twl_scsiop_execute_scsi(TW_Device_Extension *tw_dev, int request_id,
+				   unsigned char *cdb, int use_sg,
+				   TW_SG_Entry_ISO *sglistarg)
 {
 	TW_Command_Full *full_command_packet;
 	TW_Command_Apache *command_packet;
@@ -372,7 +374,7 @@ static int twl_scsiop_execute_scsi(TW_Device_Extension *tw_dev, int request_id,
 /* This function will read the aen queue from the isr */
 static int twl_aen_read_queue(TW_Device_Extension *tw_dev, int request_id)
 {
-	char cdb[TW_MAX_CDB_LEN];
+	unsigned char cdb[TW_MAX_CDB_LEN];
 	TW_SG_Entry_ISO sglist[1];
 	TW_Command_Full *full_command_packet;
 	int retval = 1;
@@ -554,7 +556,7 @@ static int twl_poll_response(TW_Device_Extension *tw_dev, int request_id, int se
 static int twl_aen_drain_queue(TW_Device_Extension *tw_dev, int no_check_reset)
 {
 	int request_id = 0;
-	char cdb[TW_MAX_CDB_LEN];
+	unsigned char cdb[TW_MAX_CDB_LEN];
 	TW_SG_Entry_ISO sglist[1];
 	int finished = 0, count = 0;
 	TW_Command_Full *full_command_packet;
-- 
2.19.1


^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH] scsi: 3w-{sas,9xxx}: Use unsigned char for cdb
  2018-10-18 21:55 [PATCH] scsi: 3w-{sas,9xxx}: Use unsigned char for cdb Nathan Chancellor
@ 2018-10-19 20:59 ` adam radford
  2018-10-19 21:03 ` adam radford
  2018-10-24  1:29 ` Martin K. Petersen
  2 siblings, 0 replies; 4+ messages in thread
From: adam radford @ 2018-10-19 20:59 UTC (permalink / raw)
  To: natechancellor
  Cc: James E.J. Bottomley, Martin K. Petersen, linux-scsi, linux-kernel

On Thu, Oct 18, 2018 at 2:55 PM Nathan Chancellor
<natechancellor@gmail.com> wrote:
>
> Clang warns a few times:
>
> drivers/scsi/3w-sas.c:386:11: warning: implicit conversion from 'int' to
> 'char' changes value from 128 to -128 [-Wconstant-conversion]
>         cdb[4] = TW_ALLOCATION_LENGTH; /* allocation length */
>                ~ ^~~~~~~~~~~~~~~~~~~~
>
> Update cdb's type to unsigned char, which matches the type of the cdb
> member in struct TW_Command_Apache.
>
> Link: https://github.com/ClangBuiltLinux/linux/issues/158
> Signed-off-by: Nathan Chancellor <natechancellor@gmail.com>
> ---
>  drivers/scsi/3w-9xxx.c | 12 ++++++++----
>  drivers/scsi/3w-sas.c  |  8 +++++---
>  2 files changed, 13 insertions(+), 7 deletions(-)
>
> diff --git a/drivers/scsi/3w-9xxx.c b/drivers/scsi/3w-9xxx.c
> index 05293babb031..2d655a97b959 100644
> --- a/drivers/scsi/3w-9xxx.c
> +++ b/drivers/scsi/3w-9xxx.c
> @@ -143,7 +143,9 @@ static int twa_poll_status_gone(TW_Device_Extension *tw_dev, u32 flag, int secon
>  static int twa_post_command_packet(TW_Device_Extension *tw_dev, int request_id, char internal);
>  static int twa_reset_device_extension(TW_Device_Extension *tw_dev);
>  static int twa_reset_sequence(TW_Device_Extension *tw_dev, int soft_reset);
> -static int twa_scsiop_execute_scsi(TW_Device_Extension *tw_dev, int request_id, char *cdb, int use_sg, TW_SG_Entry *sglistarg);
> +static int twa_scsiop_execute_scsi(TW_Device_Extension *tw_dev, int request_id,
> +                                  unsigned char *cdb, int use_sg,
> +                                  TW_SG_Entry *sglistarg);
>  static void twa_scsiop_execute_scsi_complete(TW_Device_Extension *tw_dev, int request_id);
>  static char *twa_string_lookup(twa_message_type *table, unsigned int aen_code);
>
> @@ -278,7 +280,7 @@ static int twa_aen_complete(TW_Device_Extension *tw_dev, int request_id)
>  static int twa_aen_drain_queue(TW_Device_Extension *tw_dev, int no_check_reset)
>  {
>         int request_id = 0;
> -       char cdb[TW_MAX_CDB_LEN];
> +       unsigned char cdb[TW_MAX_CDB_LEN];
>         TW_SG_Entry sglist[1];
>         int finished = 0, count = 0;
>         TW_Command_Full *full_command_packet;
> @@ -423,7 +425,7 @@ static void twa_aen_queue_event(TW_Device_Extension *tw_dev, TW_Command_Apache_H
>  /* This function will read the aen queue from the isr */
>  static int twa_aen_read_queue(TW_Device_Extension *tw_dev, int request_id)
>  {
> -       char cdb[TW_MAX_CDB_LEN];
> +       unsigned char cdb[TW_MAX_CDB_LEN];
>         TW_SG_Entry sglist[1];
>         TW_Command_Full *full_command_packet;
>         int retval = 1;
> @@ -1798,7 +1800,9 @@ static int twa_scsi_queue_lck(struct scsi_cmnd *SCpnt, void (*done)(struct scsi_
>  static DEF_SCSI_QCMD(twa_scsi_queue)
>
>  /* This function hands scsi cdb's to the firmware */
> -static int twa_scsiop_execute_scsi(TW_Device_Extension *tw_dev, int request_id, char *cdb, int use_sg, TW_SG_Entry *sglistarg)
> +static int twa_scsiop_execute_scsi(TW_Device_Extension *tw_dev, int request_id,
> +                                  unsigned char *cdb, int use_sg,
> +                                  TW_SG_Entry *sglistarg)
>  {
>         TW_Command_Full *full_command_packet;
>         TW_Command_Apache *command_packet;
> diff --git a/drivers/scsi/3w-sas.c b/drivers/scsi/3w-sas.c
> index 266bdac75304..480cf82700e9 100644
> --- a/drivers/scsi/3w-sas.c
> +++ b/drivers/scsi/3w-sas.c
> @@ -287,7 +287,9 @@ static int twl_post_command_packet(TW_Device_Extension *tw_dev, int request_id)
>  } /* End twl_post_command_packet() */
>
>  /* This function hands scsi cdb's to the firmware */
> -static int twl_scsiop_execute_scsi(TW_Device_Extension *tw_dev, int request_id, char *cdb, int use_sg, TW_SG_Entry_ISO *sglistarg)
> +static int twl_scsiop_execute_scsi(TW_Device_Extension *tw_dev, int request_id,
> +                                  unsigned char *cdb, int use_sg,
> +                                  TW_SG_Entry_ISO *sglistarg)
>  {
>         TW_Command_Full *full_command_packet;
>         TW_Command_Apache *command_packet;
> @@ -372,7 +374,7 @@ static int twl_scsiop_execute_scsi(TW_Device_Extension *tw_dev, int request_id,
>  /* This function will read the aen queue from the isr */
>  static int twl_aen_read_queue(TW_Device_Extension *tw_dev, int request_id)
>  {
> -       char cdb[TW_MAX_CDB_LEN];
> +       unsigned char cdb[TW_MAX_CDB_LEN];
>         TW_SG_Entry_ISO sglist[1];
>         TW_Command_Full *full_command_packet;
>         int retval = 1;
> @@ -554,7 +556,7 @@ static int twl_poll_response(TW_Device_Extension *tw_dev, int request_id, int se
>  static int twl_aen_drain_queue(TW_Device_Extension *tw_dev, int no_check_reset)
>  {
>         int request_id = 0;
> -       char cdb[TW_MAX_CDB_LEN];
> +       unsigned char cdb[TW_MAX_CDB_LEN];
>         TW_SG_Entry_ISO sglist[1];
>         int finished = 0, count = 0;
>         TW_Command_Full *full_command_packet;
> --
> 2.19.1
>

Looks ok.

Signed-off-by: Adam Radford <aradford@gmail.com>

-Adam

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] scsi: 3w-{sas,9xxx}: Use unsigned char for cdb
  2018-10-18 21:55 [PATCH] scsi: 3w-{sas,9xxx}: Use unsigned char for cdb Nathan Chancellor
  2018-10-19 20:59 ` adam radford
@ 2018-10-19 21:03 ` adam radford
  2018-10-24  1:29 ` Martin K. Petersen
  2 siblings, 0 replies; 4+ messages in thread
From: adam radford @ 2018-10-19 21:03 UTC (permalink / raw)
  To: Nathan Chancellor
  Cc: James E.J. Bottomley, Martin K. Petersen, linux-scsi, linux-kernel

On Thu, Oct 18, 2018 at 2:55 PM Nathan Chancellor
<natechancellor@gmail.com> wrote:
>
> Clang warns a few times:
>
> drivers/scsi/3w-sas.c:386:11: warning: implicit conversion from 'int' to
> 'char' changes value from 128 to -128 [-Wconstant-conversion]
>         cdb[4] = TW_ALLOCATION_LENGTH; /* allocation length */
>                ~ ^~~~~~~~~~~~~~~~~~~~
>
> Update cdb's type to unsigned char, which matches the type of the cdb
> member in struct TW_Command_Apache.
>
> Link: https://github.com/ClangBuiltLinux/linux/issues/158
> Signed-off-by: Nathan Chancellor <natechancellor@gmail.com>
> ---
>  drivers/scsi/3w-9xxx.c | 12 ++++++++----
>  drivers/scsi/3w-sas.c  |  8 +++++---
>  2 files changed, 13 insertions(+), 7 deletions(-)
>
> diff --git a/drivers/scsi/3w-9xxx.c b/drivers/scsi/3w-9xxx.c
> index 05293babb031..2d655a97b959 100644
> --- a/drivers/scsi/3w-9xxx.c
> +++ b/drivers/scsi/3w-9xxx.c
> @@ -143,7 +143,9 @@ static int twa_poll_status_gone(TW_Device_Extension *tw_dev, u32 flag, int secon
>  static int twa_post_command_packet(TW_Device_Extension *tw_dev, int request_id, char internal);
>  static int twa_reset_device_extension(TW_Device_Extension *tw_dev);
>  static int twa_reset_sequence(TW_Device_Extension *tw_dev, int soft_reset);
> -static int twa_scsiop_execute_scsi(TW_Device_Extension *tw_dev, int request_id, char *cdb, int use_sg, TW_SG_Entry *sglistarg);
> +static int twa_scsiop_execute_scsi(TW_Device_Extension *tw_dev, int request_id,
> +                                  unsigned char *cdb, int use_sg,
> +                                  TW_SG_Entry *sglistarg);
>  static void twa_scsiop_execute_scsi_complete(TW_Device_Extension *tw_dev, int request_id);
>  static char *twa_string_lookup(twa_message_type *table, unsigned int aen_code);
>
> @@ -278,7 +280,7 @@ static int twa_aen_complete(TW_Device_Extension *tw_dev, int request_id)
>  static int twa_aen_drain_queue(TW_Device_Extension *tw_dev, int no_check_reset)
>  {
>         int request_id = 0;
> -       char cdb[TW_MAX_CDB_LEN];
> +       unsigned char cdb[TW_MAX_CDB_LEN];
>         TW_SG_Entry sglist[1];
>         int finished = 0, count = 0;
>         TW_Command_Full *full_command_packet;
> @@ -423,7 +425,7 @@ static void twa_aen_queue_event(TW_Device_Extension *tw_dev, TW_Command_Apache_H
>  /* This function will read the aen queue from the isr */
>  static int twa_aen_read_queue(TW_Device_Extension *tw_dev, int request_id)
>  {
> -       char cdb[TW_MAX_CDB_LEN];
> +       unsigned char cdb[TW_MAX_CDB_LEN];
>         TW_SG_Entry sglist[1];
>         TW_Command_Full *full_command_packet;
>         int retval = 1;
> @@ -1798,7 +1800,9 @@ static int twa_scsi_queue_lck(struct scsi_cmnd *SCpnt, void (*done)(struct scsi_
>  static DEF_SCSI_QCMD(twa_scsi_queue)
>
>  /* This function hands scsi cdb's to the firmware */
> -static int twa_scsiop_execute_scsi(TW_Device_Extension *tw_dev, int request_id, char *cdb, int use_sg, TW_SG_Entry *sglistarg)
> +static int twa_scsiop_execute_scsi(TW_Device_Extension *tw_dev, int request_id,
> +                                  unsigned char *cdb, int use_sg,
> +                                  TW_SG_Entry *sglistarg)
>  {
>         TW_Command_Full *full_command_packet;
>         TW_Command_Apache *command_packet;
> diff --git a/drivers/scsi/3w-sas.c b/drivers/scsi/3w-sas.c
> index 266bdac75304..480cf82700e9 100644
> --- a/drivers/scsi/3w-sas.c
> +++ b/drivers/scsi/3w-sas.c
> @@ -287,7 +287,9 @@ static int twl_post_command_packet(TW_Device_Extension *tw_dev, int request_id)
>  } /* End twl_post_command_packet() */
>
>  /* This function hands scsi cdb's to the firmware */
> -static int twl_scsiop_execute_scsi(TW_Device_Extension *tw_dev, int request_id, char *cdb, int use_sg, TW_SG_Entry_ISO *sglistarg)
> +static int twl_scsiop_execute_scsi(TW_Device_Extension *tw_dev, int request_id,
> +                                  unsigned char *cdb, int use_sg,
> +                                  TW_SG_Entry_ISO *sglistarg)
>  {
>         TW_Command_Full *full_command_packet;
>         TW_Command_Apache *command_packet;
> @@ -372,7 +374,7 @@ static int twl_scsiop_execute_scsi(TW_Device_Extension *tw_dev, int request_id,
>  /* This function will read the aen queue from the isr */
>  static int twl_aen_read_queue(TW_Device_Extension *tw_dev, int request_id)
>  {
> -       char cdb[TW_MAX_CDB_LEN];
> +       unsigned char cdb[TW_MAX_CDB_LEN];
>         TW_SG_Entry_ISO sglist[1];
>         TW_Command_Full *full_command_packet;
>         int retval = 1;
> @@ -554,7 +556,7 @@ static int twl_poll_response(TW_Device_Extension *tw_dev, int request_id, int se
>  static int twl_aen_drain_queue(TW_Device_Extension *tw_dev, int no_check_reset)
>  {
>         int request_id = 0;
> -       char cdb[TW_MAX_CDB_LEN];
> +       unsigned char cdb[TW_MAX_CDB_LEN];
>         TW_SG_Entry_ISO sglist[1];
>         int finished = 0, count = 0;
>         TW_Command_Full *full_command_packet;
> --
> 2.19.1
>

Looks ok.

Acked-by: Adam Radford <aradford@gmail.com>

-Adam

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] scsi: 3w-{sas,9xxx}: Use unsigned char for cdb
  2018-10-18 21:55 [PATCH] scsi: 3w-{sas,9xxx}: Use unsigned char for cdb Nathan Chancellor
  2018-10-19 20:59 ` adam radford
  2018-10-19 21:03 ` adam radford
@ 2018-10-24  1:29 ` Martin K. Petersen
  2 siblings, 0 replies; 4+ messages in thread
From: Martin K. Petersen @ 2018-10-24  1:29 UTC (permalink / raw)
  To: Nathan Chancellor
  Cc: Adam Radford, James E.J. Bottomley, Martin K. Petersen,
	linux-scsi, linux-kernel


Nathan,

> Clang warns a few times:
>
> drivers/scsi/3w-sas.c:386:11: warning: implicit conversion from 'int' to
> 'char' changes value from 128 to -128 [-Wconstant-conversion]
>         cdb[4] = TW_ALLOCATION_LENGTH; /* allocation length */
>                ~ ^~~~~~~~~~~~~~~~~~~~
>
> Update cdb's type to unsigned char, which matches the type of the cdb
> member in struct TW_Command_Apache.

Applied to 4.20/scsi-queue. Thank you.

-- 
Martin K. Petersen	Oracle Linux Engineering

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2018-10-24  4:31 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-10-18 21:55 [PATCH] scsi: 3w-{sas,9xxx}: Use unsigned char for cdb Nathan Chancellor
2018-10-19 20:59 ` adam radford
2018-10-19 21:03 ` adam radford
2018-10-24  1:29 ` Martin K. Petersen

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).