Re: [PATCH v3 2/2] perf: Add Raspberry Pi 5 (BCM2712) AXI PMU support
| Newsgroups | org.kernel.vger.linux-perf-users |
|---|---|
| Message-ID | <[email protected]> |
Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider: - [Low] Implicit and fragile pointer cast from `struct pmu *` to `struct rpi_axi_pmu *` instead of using `container_of`. -- --- Patch [2]: [PATCH v3 2/2] perf: Add Raspberry Pi 5 (BCM2712) AXI PMU support --- commit 313acedcd7c09e03b7e84ac26f169991353b78d9 Author: Ian Rogers <[email protected]> Subject: perf: Add Raspberry Pi 5 (BCM2712) AXI PMU support This commit expands the Raspberry Pi AXI PMU driver to support the Broadcom BCM2712 SoC used in the Raspberry Pi 5. It adds new event definitions, bus enumerations, and filter aliases specifically for the new architecture. > diff --git a/drivers/perf/rpi_axi_pmu.c b/drivers/perf/rpi_axi_pmu.c > index 1923dc34cb3e9..478d58c7e4f41 100644 > --- a/drivers/perf/rpi_axi_pmu.c > +++ b/drivers/perf/rpi_axi_pmu.c [ ... ] > @@ -867,12 +1043,106 @@ static struct attribute *rpi_axi_pmu_events_attrs[] = { [ ... ] > +static umode_t rpi_axi_pmu_events_is_visible(struct kobject *kobj, > + struct attribute *attr, int unused) > +{ > + struct device *dev = kobj_to_dev(kobj); > + struct rpi_axi_pmu *pmu = dev_get_drvdata(dev); [Severity: Low] Since the perf core sets the device's driver data to a struct pmu pointer via pmu_dev_alloc(), doesn't dev_get_drvdata(dev) return a struct pmu * here? While this implicit cast works right now because the pmu member is located at offset 0 in struct rpi_axi_pmu, would it be safer to use the existing pmu_to_rpi_axi_pmu() helper to avoid potential type confusion and memory corruption if the struct layout ever changes in the future? > + struct perf_pmu_events_attr *pmu_attr; > + > + pmu_attr = container_of(attr, struct perf_pmu_events_attr, attr.attr); > + > + if (pmu->chip == CHIP_BCM2712) { -- Sashiko AI review · https://sashiko.dev/#/patchset/[email protected]?part=2