diff --git a/drivers/roh/core/core.c b/drivers/roh/core/core.c index 9ff4e8bdd4319d7616faff3d0a3fa5bb57ae8719..27f9625d707d4768092c8de756130177dc675ffb 100644 --- a/drivers/roh/core/core.c +++ b/drivers/roh/core/core.c @@ -617,7 +617,7 @@ int roh_device_set_eid(struct roh_device *device, struct roh_eid_attr *attr) return ret; } - device->eid = *attr; + memcpy(&device->eid, attr, sizeof(device->eid)); ret = roh_set_mac_by_eid(device, attr); mutex_unlock(&device->eid_mutex); diff --git a/drivers/roh/core/sysfs.c b/drivers/roh/core/sysfs.c index c8b6ac28eabc236f0a81c1848c9a9ae5bf89f4cf..6b7994a2432228d4ac9f78e835661e462a6b6c96 100644 --- a/drivers/roh/core/sysfs.c +++ b/drivers/roh/core/sysfs.c @@ -159,7 +159,9 @@ static struct attribute *alloc_hsa(const char *name, static void free_hw_stats(struct roh_device *device) { kfree(device->hw_private_stats); + device->hw_private_stats = NULL; kfree(device->hw_public_stats); + device->hw_public_stats = NULL; } static int alloc_and_get_hw_stats(struct roh_device *device) @@ -203,7 +205,8 @@ static int alloc_and_get_hw_stats(struct roh_device *device) return 0; err: - free_hw_stats(device); + kfree(privite_stats); + kfree(public_stats); return ret; } @@ -309,7 +312,8 @@ int roh_device_register_sysfs(struct roh_device *device) return 0; err: - remove_device_sysfs(device); + for (i = i - 1; i >= 0; i--) + device_remove_file(&device->dev, roh_class_attr[i]); return ret; } diff --git a/drivers/roh/hw/hns3/hns3_main.c b/drivers/roh/hw/hns3/hns3_main.c index 05cd71de6ad02128fbc97a54bd86cc944a25c0c5..7a71cd15f69d2c43e5c67a33aa419b33fb4ac726 100644 --- a/drivers/roh/hw/hns3/hns3_main.c +++ b/drivers/roh/hw/hns3/hns3_main.c @@ -536,8 +536,6 @@ static void hns3_roh_dfx_uninit(struct hns3_roh_device *hroh_dev) static void hns3_roh_dfx_register_debugfs(const char *dir_name) { hns3_roh_dfx_root = debugfs_create_dir(dir_name, NULL); - if (IS_ERR_OR_NULL(hns3_roh_dfx_root)) - return; } static void hns3_roh_dfx_unregister_debugfs(void)