perf/x86/intel/uncore: Drop unnecessary NULL checks after container_of
Subsystems (2)
PATCH 1/1 perf/x86/intel/uncore: Drop unnecessary NULL checks after container_of
The parameter passed to pmu_enable and pmu_disable functions can not be NULL because it is dereferenced by the caller. That means the result of container_of() on that parameter can also never be NULL. The existing NULL checks are therefore unnecessary and misleading. Remove them.
This change was made automatically with the following Coccinelle script.
@@
type t;
identifier v;
statement s;
@@
<+...
(
t v = container_of(...);
|
v = container_of(...);
)
...
when != v
- if (\( !v \| v == NULL \) ) s
...+>
--- arch/x86/events/intel/uncore.c | 4 ---- 1 file changed, 4 deletions(-)
arch/x86/events/intel/uncore.c +0 -4
@@ -801,8 +801,6 @@ static void uncore_pmu_enable(struct pmu *pmu)struct intel_uncore_box *box; uncore_pmu = container_of(pmu, struct intel_uncore_pmu, pmu); -if (!uncore_pmu) -return ; box =uncore_pmu_to_box (uncore_pmu,smp_processor_id ());if (!box)
@@ -818,8 +816,6 @@ static void uncore_pmu_disable(struct pmu *pmu)struct intel_uncore_box *box; uncore_pmu = container_of(pmu, struct intel_uncore_pmu, pmu); -if (!uncore_pmu) -return ; box =uncore_pmu_to_box (uncore_pmu,smp_processor_id ());if (!box)
Signature · 1 line
2.25.1
[tip: perf/core] perf/x86/intel/uncore: Drop unnecessary NULL checks after container_of()
The following commit has been merged into the perf/core branch of tip:
The following commit has been merged into the perf/core branch of tip:
Commit-ID: 440e906702410f59ae5397ec9e3b639edb53f80e Gitweb: https://git.kernel.org/tip/440e906702410f59ae5397ec9e3b639edb53f80e Author: Guenter Roeck <[email protected]> AuthorDate: Mon, 10 May 2021 15:48:49 -07:00 Committer: Ingo Molnar <[email protected]> CommitterDate: Wed, 12 May 2021 10:44:21 +02:00
perf/x86/intel/uncore: Drop unnecessary NULL checks after container_of()
The parameter passed to the pmu_enable() and pmu_disable() functions can not be NULL because it is dereferenced by the caller.
That means the result of container_of() on that parameter can also never be NULL. The existing NULL checks are therefore unnecessary and misleading. Remove them.
This change was made automatically with the following Coccinelle script.
@@
type t;
identifier v;
statement s;
@@
<+...
(
t v = container_of(...);
|
v = container_of(...);
)
...
when != v
- if (\( !v \| v == NULL \) ) s
...+>--- arch/x86/events/intel/uncore.c | 4 ---- 1 file changed, 4 deletions(-)
arch/x86/events/intel/uncore.c +0 -4
@@ -801,8 +801,6 @@ static void uncore_pmu_enable(struct pmu *pmu)struct intel_uncore_box *box; uncore_pmu = container_of(pmu, struct intel_uncore_pmu, pmu); -if (!uncore_pmu) -return ; box =uncore_pmu_to_box (uncore_pmu,smp_processor_id ());if (!box)
@@ -818,8 +816,6 @@ static void uncore_pmu_disable(struct pmu *pmu)struct intel_uncore_box *box; uncore_pmu = container_of(pmu, struct intel_uncore_pmu, pmu); -if (!uncore_pmu) -return ; box =uncore_pmu_to_box (uncore_pmu,smp_processor_id ());if (!box)