Make sure to check the pmu type first and then check event->attr.disabled.
Doing so would avoid reading the disabled attribute of an event that is
not handled by TAD PMU.
Signed-off-by: Tanmay Jagdale <tanmay@marvell.com>
Link: https://lore.kernel.org/r/20220510102657.487539-1-tanmay@marvell.com
Signed-off-by: Will Deacon <will@kernel.org>
 
 {
        struct tad_pmu *tad_pmu = to_tad_pmu(event->pmu);
 
-       if (!event->attr.disabled)
-               return -EINVAL;
-
        if (event->attr.type != event->pmu->type)
                return -ENOENT;
 
+       if (!event->attr.disabled)
+               return -EINVAL;
+
        if (event->state != PERF_EVENT_STATE_OFF)
                return -EINVAL;