Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 0ef22892 authored by Linux Build Service Account's avatar Linux Build Service Account Committed by Gerrit - the friendly Code Review server
Browse files

Merge "power: pmic-voter: fix memory leak in create_votable"

parents 9f3261c0 bdd8d351
Loading
Loading
Loading
Loading
+5 −5
Original line number Original line Diff line number Diff line
@@ -223,11 +223,7 @@ struct votable *create_votable(struct device *dev, const char *name,
					)
					)
{
{
	int i;
	int i;
	struct votable *votable = devm_kzalloc(dev, sizeof(struct votable),
	struct votable *votable;
							GFP_KERNEL);

	if (!votable)
		return ERR_PTR(-ENOMEM);


	if (!callback) {
	if (!callback) {
		dev_err(dev, "Invalid callback specified for voter\n");
		dev_err(dev, "Invalid callback specified for voter\n");
@@ -244,6 +240,10 @@ struct votable *create_votable(struct device *dev, const char *name,
		return ERR_PTR(-EINVAL);
		return ERR_PTR(-EINVAL);
	}
	}


	votable = devm_kzalloc(dev, sizeof(struct votable), GFP_KERNEL);
	if (!votable)
		return ERR_PTR(-ENOMEM);

	votable->dev = dev;
	votable->dev = dev;
	votable->name = name;
	votable->name = name;
	votable->num_clients = num_clients;
	votable->num_clients = num_clients;