OpenCloudOS-Kernel/drivers/perf/hisilicon
Junhao He 257aedb72e drivers/perf: hisi: add NULL check for name
When allocations fails that can be NULL now.

If the name provided is NULL, then the initialization process of the PMU
type and dev will be skipped in function perf_pmu_register().
Consequently, the PMU will not be able to register into the kernel.
Moreover, in the case of unregister the PMU, the function device_del()
will need to handle NULL pointers, which potentially can cause issues.

So move this allocation above the cpuhp_state_add_instance() and directly
return if it does fail.

Signed-off-by: Junhao He <hejunhao3@huawei.com>
Reviewed-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
Link: https://lore.kernel.org/r/20230403081423.62460-3-hejunhao3@huawei.com
Signed-off-by: Will Deacon <will@kernel.org>
2023-04-17 13:14:10 +01:00
..
Kconfig drivers/perf: hisi: add driver for HNS3 PMU 2022-07-06 11:25:53 +01:00
Makefile drivers/perf: hisi: add driver for HNS3 PMU 2022-07-06 11:25:53 +01:00
hisi_pcie_pmu.c drivers/perf: hisi: Add TLP filter support 2022-11-29 14:30:55 +00:00
hisi_uncore_cpa_pmu.c drivers/perf: hisi: Remove redundant initialized of pmu->name 2023-04-17 13:14:10 +01:00
hisi_uncore_ddrc_pmu.c drivers/perf: hisi: add NULL check for name 2023-04-17 13:14:10 +01:00
hisi_uncore_hha_pmu.c drivers/perf: hisi: add NULL check for name 2023-04-17 13:14:10 +01:00
hisi_uncore_l3c_pmu.c drivers/perf: hisi: add NULL check for name 2023-04-17 13:14:10 +01:00
hisi_uncore_pa_pmu.c drivers/perf: hisi: Remove redundant initialized of pmu->name 2023-04-17 13:14:10 +01:00
hisi_uncore_pmu.c drivers/perf: hisi: Remove redundant initialized of pmu->name 2023-04-17 13:14:10 +01:00
hisi_uncore_pmu.h drivers/perf: hisi: Remove redundant initialized of pmu->name 2023-04-17 13:14:10 +01:00
hisi_uncore_sllc_pmu.c drivers/perf: hisi: Remove redundant initialized of pmu->name 2023-04-17 13:14:10 +01:00
hns3_pmu.c drivers/perf: hisi: add driver for HNS3 PMU 2022-07-06 11:25:53 +01:00