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

Commit f6a5242b authored by Sakari Ailus's avatar Sakari Ailus Committed by Mauro Carvalho Chehab
Browse files

media: ipu3-cio2: Clean up notifier's subdev list if parsing endpoints fails



The notifier must be cleaned up whenever parsing endpoints fails. Do that
to avoid a memory leak in that case.

Signed-off-by: default avatarSakari Ailus <sakari.ailus@linux.intel.com>
Signed-off-by: default avatarMauro Carvalho Chehab <mchehab+samsung@kernel.org>
parent d1e16428
Loading
Loading
Loading
Loading
+6 −2
Original line number Diff line number Diff line
@@ -1504,7 +1504,7 @@ static int cio2_notifier_init(struct cio2_device *cio2)
		sizeof(struct sensor_async_subdev),
		cio2_fwnode_parse);
	if (ret < 0)
		return ret;
		goto out;

	if (list_empty(&cio2->notifier.asd_list))
		return -ENODEV;	/* no endpoint */
@@ -1514,9 +1514,13 @@ static int cio2_notifier_init(struct cio2_device *cio2)
	if (ret) {
		dev_err(&cio2->pci_dev->dev,
			"failed to register async notifier : %d\n", ret);
		v4l2_async_notifier_cleanup(&cio2->notifier);
		goto out;
	}

out:
	if (ret)
		v4l2_async_notifier_cleanup(&cio2->notifier);

	return ret;
}