summaryrefslogtreecommitdiff
path: root/drivers/media/pci
diff options
context:
space:
mode:
authorSakari Ailus <sakari.ailus@linux.intel.com>2019-03-04 04:36:40 -0500
committerMauro Carvalho Chehab <mchehab+samsung@kernel.org>2019-07-25 11:00:25 -0400
commitf6a5242b7cf20bf34e5362896df310a35ba3b90b (patch)
treef1a82f92b352a1874032a26ac70fc3a7272ac280 /drivers/media/pci
parentd1e164289e55de90fcc5680f459a43972430a28d (diff)
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: Sakari Ailus <sakari.ailus@linux.intel.com> Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
Diffstat (limited to 'drivers/media/pci')
-rw-r--r--drivers/media/pci/intel/ipu3/ipu3-cio2.c8
1 files changed, 6 insertions, 2 deletions
diff --git a/drivers/media/pci/intel/ipu3/ipu3-cio2.c b/drivers/media/pci/intel/ipu3/ipu3-cio2.c
index 50a34bcd4d14..52bd35c240dd 100644
--- a/drivers/media/pci/intel/ipu3/ipu3-cio2.c
+++ b/drivers/media/pci/intel/ipu3/ipu3-cio2.c
@@ -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;
}