habanalabs/gaudi2: added memset for the cq_size register

Message ID 20221123085640.103084-1-marpagan@redhat.com
State New
Headers
Series habanalabs/gaudi2: added memset for the cq_size register |

Commit Message

Marco Pagani Nov. 23, 2022, 8:56 a.m. UTC
  The clang-analyzer reported a warning: "Value stored to
'cq_size_addr' is never read".

The cq_size register of dcore0 is not being zeroed using
gaudi2_memset_device_lbw(), along with the other cq_* registers,
even though the corresponding cq_size_addr variable is set.

Signed-off-by: Marco Pagani <marpagan@redhat.com>
---
 drivers/misc/habanalabs/gaudi2/gaudi2.c | 1 +
 1 file changed, 1 insertion(+)
  

Comments

Oded Gabbay Nov. 23, 2022, 2:32 p.m. UTC | #1
On Wed, Nov 23, 2022 at 10:59 AM Marco Pagani <marpagan@redhat.com> wrote:
>
> The clang-analyzer reported a warning: "Value stored to
> 'cq_size_addr' is never read".
>
> The cq_size register of dcore0 is not being zeroed using
> gaudi2_memset_device_lbw(), along with the other cq_* registers,
> even though the corresponding cq_size_addr variable is set.
>
> Signed-off-by: Marco Pagani <marpagan@redhat.com>
> ---
>  drivers/misc/habanalabs/gaudi2/gaudi2.c | 1 +
>  1 file changed, 1 insertion(+)
>
> diff --git a/drivers/misc/habanalabs/gaudi2/gaudi2.c b/drivers/misc/habanalabs/gaudi2/gaudi2.c
> index 65e6cae6100a..05f30adefb32 100644
> --- a/drivers/misc/habanalabs/gaudi2/gaudi2.c
> +++ b/drivers/misc/habanalabs/gaudi2/gaudi2.c
> @@ -9165,6 +9165,7 @@ static void gaudi2_restore_user_sm_registers(struct hl_device *hdev)
>         gaudi2_memset_device_lbw(hdev, cq_lbw_data_addr, size, 0);
>         gaudi2_memset_device_lbw(hdev, cq_base_l_addr, size, 0);
>         gaudi2_memset_device_lbw(hdev, cq_base_h_addr, size, 0);
> +       gaudi2_memset_device_lbw(hdev, cq_size_addr, size, 0);
>
>         cq_lbw_l_addr = mmDCORE0_SYNC_MNGR_GLBL_LBW_ADDR_L_0 + DCORE_OFFSET;
>         cq_lbw_h_addr = mmDCORE0_SYNC_MNGR_GLBL_LBW_ADDR_H_0 + DCORE_OFFSET;
> --
> 2.38.1
>
Reviewed-by: Oded Gabbay <ogabbay@kernel.org>
Applied to -next.
Thanks,
Oded
  

Patch

diff --git a/drivers/misc/habanalabs/gaudi2/gaudi2.c b/drivers/misc/habanalabs/gaudi2/gaudi2.c
index 65e6cae6100a..05f30adefb32 100644
--- a/drivers/misc/habanalabs/gaudi2/gaudi2.c
+++ b/drivers/misc/habanalabs/gaudi2/gaudi2.c
@@ -9165,6 +9165,7 @@  static void gaudi2_restore_user_sm_registers(struct hl_device *hdev)
 	gaudi2_memset_device_lbw(hdev, cq_lbw_data_addr, size, 0);
 	gaudi2_memset_device_lbw(hdev, cq_base_l_addr, size, 0);
 	gaudi2_memset_device_lbw(hdev, cq_base_h_addr, size, 0);
+	gaudi2_memset_device_lbw(hdev, cq_size_addr, size, 0);
 
 	cq_lbw_l_addr = mmDCORE0_SYNC_MNGR_GLBL_LBW_ADDR_L_0 + DCORE_OFFSET;
 	cq_lbw_h_addr = mmDCORE0_SYNC_MNGR_GLBL_LBW_ADDR_H_0 + DCORE_OFFSET;