if (event_fd < 0)
return event_fd;
- event = perf_event_alloc(&attr, cpu, group_leader, NULL, NULL);
- if (IS_ERR(event)) {
- err = PTR_ERR(event);
- goto err_fd;
- }
-
if (group_fd != -1) {
group_leader = perf_fget_light(group_fd, &fput_needed);
if (IS_ERR(group_leader)) {
err = PTR_ERR(group_leader);
- goto err_alloc;
+ goto err_fd;
}
group_file = group_leader->filp;
if (flags & PERF_FLAG_FD_OUTPUT)
group_leader = NULL;
}
+ event = perf_event_alloc(&attr, cpu, group_leader, NULL, NULL);
+ if (IS_ERR(event)) {
+ err = PTR_ERR(event);
+ goto err_fd;
+ }
+
/*
* Special case software events and allow them to be part of
* any hardware group.
put_ctx(ctx);
err_group_fd:
fput_light(group_file, fput_needed);
-err_alloc:
free_event(event);
err_fd:
put_unused_fd(event_fd);