From 0f89afd405eaa387d14d98a5cd186c016cec35e1 Mon Sep 17 00:00:00 2001 From: Liang Yuhang Date: Wed, 26 Apr 2023 19:49:34 +0800 Subject: [PATCH] scsi/hifc: replace kmalloc and memset with kzalloc driver inclusion category: other bugzilla: https://gitee.com/openeuler/kernel/issues/I6Z5OY Reference: NA --------------------------------------- Use kzalloc instead of kmalloc to ensure that the allocated space is initialized to zero. And removed the call to memset to initialize the memory. Signed-off-by: Liang Yuhang --- drivers/scsi/huawei/hifc/hifc_cqm_main.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/drivers/scsi/huawei/hifc/hifc_cqm_main.c b/drivers/scsi/huawei/hifc/hifc_cqm_main.c index 4cd048f1e662..930b4ff5746c 100644 --- a/drivers/scsi/huawei/hifc/hifc_cqm_main.c +++ b/drivers/scsi/huawei/hifc/hifc_cqm_main.c @@ -206,12 +206,10 @@ s32 cqm_init(void *ex_handle) CQM_PTR_CHECK_RET(ex_handle, return CQM_FAIL, CQM_PTR_NULL(ex_handle)); - cqm_handle = (struct cqm_handle_s *)kmalloc(sizeof(struct cqm_handle_s), + cqm_handle = kzalloc(sizeof(struct cqm_handle_s), GFP_KERNEL | __GFP_ZERO); CQM_PTR_CHECK_RET(cqm_handle, return CQM_FAIL, CQM_ALLOC_FAIL(cqm_handle)); - /* Clear memory to prevent other systems' memory from being cleared */ - memset(cqm_handle, 0, sizeof(struct cqm_handle_s)); cqm_handle->ex_handle = handle; cqm_handle->dev = (struct pci_dev *)(handle->pcidev_hdl); -- Gitee