diff mbox series

[v4,09/31] scsi: pm8001: Fix payload initialization in pm80xx_encrypt_update()

Message ID 20220217132956.484818-10-damien.lemoal@opensource.wdc.com
State Superseded
Headers show
Series libsas and pm8001 fixes | expand

Commit Message

Damien Le Moal Feb. 17, 2022, 1:29 p.m. UTC
All fields of the kek_mgmt_req structure have the type __le32. So make
sure to use cpu_to_le32() to initialize them. This suppresses the sparse
warning:

warning: incorrect type in assignment (different base types)
   expected restricted __le32 [addressable] [assigned] [usertype] new_curidx_ksop
   got int

Fixes: 5860992db55c ("[SCSI] pm80xx: Added SPCv/ve specific hardware functionalities and relevant changes in common files")
Signed-off-by: Damien Le Moal <damien.lemoal@opensource.wdc.com>
---
 drivers/scsi/pm8001/pm80xx_hwi.c | 7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)

Comments

Jinpu Wang Feb. 17, 2022, 7:08 p.m. UTC | #1
On Thu, Feb 17, 2022 at 2:30 PM Damien Le Moal
<damien.lemoal@opensource.wdc.com> wrote:
>
> All fields of the kek_mgmt_req structure have the type __le32. So make
> sure to use cpu_to_le32() to initialize them. This suppresses the sparse
> warning:
>
> warning: incorrect type in assignment (different base types)
>    expected restricted __le32 [addressable] [assigned] [usertype] new_curidx_ksop
>    got int
>
> Fixes: 5860992db55c ("[SCSI] pm80xx: Added SPCv/ve specific hardware functionalities and relevant changes in common files")
> Signed-off-by: Damien Le Moal <damien.lemoal@opensource.wdc.com>
Reviewed-by: Jack Wang <jinpu.wang@ionos.com>
thx!
> ---
>  drivers/scsi/pm8001/pm80xx_hwi.c | 7 ++++---
>  1 file changed, 4 insertions(+), 3 deletions(-)
>
> diff --git a/drivers/scsi/pm8001/pm80xx_hwi.c b/drivers/scsi/pm8001/pm80xx_hwi.c
> index e6fb89138030..b06d5ded45ca 100644
> --- a/drivers/scsi/pm8001/pm80xx_hwi.c
> +++ b/drivers/scsi/pm8001/pm80xx_hwi.c
> @@ -1405,12 +1405,13 @@ static int pm80xx_encrypt_update(struct pm8001_hba_info *pm8001_ha)
>         /* Currently only one key is used. New KEK index is 1.
>          * Current KEK index is 1. Store KEK to NVRAM is 1.
>          */
> -       payload.new_curidx_ksop = ((1 << 24) | (1 << 16) | (1 << 8) |
> -                                       KEK_MGMT_SUBOP_KEYCARDUPDATE);
> +       payload.new_curidx_ksop =
> +               cpu_to_le32(((1 << 24) | (1 << 16) | (1 << 8) |
> +                            KEK_MGMT_SUBOP_KEYCARDUPDATE));
>
>         pm8001_dbg(pm8001_ha, DEV,
>                    "Saving Encryption info to flash. payload 0x%x\n",
> -                  payload.new_curidx_ksop);
> +                  le32_to_cpu(payload.new_curidx_ksop));
>
>         rc = pm8001_mpi_build_cmd(pm8001_ha, circularQ, opc, &payload,
>                         sizeof(payload), 0);
> --
> 2.34.1
>
diff mbox series

Patch

diff --git a/drivers/scsi/pm8001/pm80xx_hwi.c b/drivers/scsi/pm8001/pm80xx_hwi.c
index e6fb89138030..b06d5ded45ca 100644
--- a/drivers/scsi/pm8001/pm80xx_hwi.c
+++ b/drivers/scsi/pm8001/pm80xx_hwi.c
@@ -1405,12 +1405,13 @@  static int pm80xx_encrypt_update(struct pm8001_hba_info *pm8001_ha)
 	/* Currently only one key is used. New KEK index is 1.
 	 * Current KEK index is 1. Store KEK to NVRAM is 1.
 	 */
-	payload.new_curidx_ksop = ((1 << 24) | (1 << 16) | (1 << 8) |
-					KEK_MGMT_SUBOP_KEYCARDUPDATE);
+	payload.new_curidx_ksop =
+		cpu_to_le32(((1 << 24) | (1 << 16) | (1 << 8) |
+			     KEK_MGMT_SUBOP_KEYCARDUPDATE));
 
 	pm8001_dbg(pm8001_ha, DEV,
 		   "Saving Encryption info to flash. payload 0x%x\n",
-		   payload.new_curidx_ksop);
+		   le32_to_cpu(payload.new_curidx_ksop));
 
 	rc = pm8001_mpi_build_cmd(pm8001_ha, circularQ, opc, &payload,
 			sizeof(payload), 0);