| From 128a9750c95640e80c1c789b275683e04f4bc91b Mon Sep 17 00:00:00 2001 |
| From: Sasha Levin <sashal@kernel.org> |
| Date: Sun, 20 Feb 2022 12:17:44 +0900 |
| Subject: scsi: pm8001: Fix pm80xx_pci_mem_copy() interface |
| |
| From: Damien Le Moal <damien.lemoal@opensource.wdc.com> |
| |
| [ Upstream commit 3762d8f6edcdb03994c919f9487fd6d336c06561 ] |
| |
| The declaration of the local variable destination1 in pm80xx_pci_mem_copy() |
| as a pointer to a u32 results in the sparse warning: |
| |
| warning: incorrect type in assignment (different base types) |
| expected unsigned int [usertype] |
| got restricted __le32 [usertype] |
| |
| Furthermore, the destination" argument of pm80xx_pci_mem_copy() is wrongly |
| declared with the const attribute. |
| |
| Fix both problems by changing the type of the "destination" argument to |
| "__le32 *" and use this argument directly inside the pm80xx_pci_mem_copy() |
| function, thus removing the need for the destination1 local variable. |
| |
| Link: https://lore.kernel.org/r/20220220031810.738362-6-damien.lemoal@opensource.wdc.com |
| Reviewed-by: Jack Wang <jinpu.wang@ionos.com> |
| Signed-off-by: Damien Le Moal <damien.lemoal@opensource.wdc.com> |
| Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com> |
| Signed-off-by: Sasha Levin <sashal@kernel.org> |
| --- |
| drivers/scsi/pm8001/pm80xx_hwi.c | 8 +++----- |
| 1 file changed, 3 insertions(+), 5 deletions(-) |
| |
| diff --git a/drivers/scsi/pm8001/pm80xx_hwi.c b/drivers/scsi/pm8001/pm80xx_hwi.c |
| index 48b0154211c7..00498e3660e1 100644 |
| --- a/drivers/scsi/pm8001/pm80xx_hwi.c |
| +++ b/drivers/scsi/pm8001/pm80xx_hwi.c |
| @@ -66,18 +66,16 @@ int pm80xx_bar4_shift(struct pm8001_hba_info *pm8001_ha, u32 shift_value) |
| } |
| |
| static void pm80xx_pci_mem_copy(struct pm8001_hba_info *pm8001_ha, u32 soffset, |
| - const void *destination, |
| + __le32 *destination, |
| u32 dw_count, u32 bus_base_number) |
| { |
| u32 index, value, offset; |
| - u32 *destination1; |
| - destination1 = (u32 *)destination; |
| |
| - for (index = 0; index < dw_count; index += 4, destination1++) { |
| + for (index = 0; index < dw_count; index += 4, destination++) { |
| offset = (soffset + index); |
| if (offset < (64 * 1024)) { |
| value = pm8001_cr32(pm8001_ha, bus_base_number, offset); |
| - *destination1 = cpu_to_le32(value); |
| + *destination = cpu_to_le32(value); |
| } |
| } |
| return; |
| -- |
| 2.35.1 |
| |