Skip to content

Commit

Permalink
Merge branch 'pm-powercap'
Browse files Browse the repository at this point in the history
Fix a possible memory leak in the power capping subsystem (Joe Hattori).

* pm-powercap:
  powercap: call put_device() on an error path in powercap_register_control_type()
  • Loading branch information
rafaeljw committed Feb 7, 2025
2 parents b3cc5af + 93c66fb commit 73195be
Showing 1 changed file with 1 addition and 2 deletions.
3 changes: 1 addition & 2 deletions drivers/powercap/powercap_sys.c
Original file line number Diff line number Diff line change
Expand Up @@ -627,8 +627,7 @@ struct powercap_control_type *powercap_register_control_type(
dev_set_name(&control_type->dev, "%s", name);
result = device_register(&control_type->dev);
if (result) {
if (control_type->allocated)
kfree(control_type);
put_device(&control_type->dev);
return ERR_PTR(result);
}
idr_init(&control_type->idr);
Expand Down

0 comments on commit 73195be

Please sign in to comment.