hc
2024-01-03 2f7c68cb55ecb7331f2381deb497c27155f32faf
kernel/drivers/media/platform/omap3isp/isphist.c
....@@ -1,3 +1,4 @@
1
+// SPDX-License-Identifier: GPL-2.0-only
12 /*
23 * isphist.c
34 *
....@@ -9,10 +10,6 @@
910 * Contacts: David Cohen <dacohen@gmail.com>
1011 * Laurent Pinchart <laurent.pinchart@ideasonboard.com>
1112 * Sakari Ailus <sakari.ailus@iki.fi>
12
- *
13
- * This program is free software; you can redistribute it and/or modify
14
- * it under the terms of the GNU General Public License version 2 as
15
- * published by the Free Software Foundation.
1613 */
1714
1815 #include <linux/delay.h>
....@@ -478,9 +475,9 @@
478475 {
479476 struct ispstat *hist = &isp->isp_hist;
480477 struct omap3isp_hist_config *hist_cfg;
481
- int ret = -1;
478
+ int ret;
482479
483
- hist_cfg = devm_kzalloc(isp->dev, sizeof(*hist_cfg), GFP_KERNEL);
480
+ hist_cfg = kzalloc(sizeof(*hist_cfg), GFP_KERNEL);
484481 if (hist_cfg == NULL)
485482 return -ENOMEM;
486483
....@@ -502,7 +499,7 @@
502499 if (IS_ERR(hist->dma_ch)) {
503500 ret = PTR_ERR(hist->dma_ch);
504501 if (ret == -EPROBE_DEFER)
505
- return ret;
502
+ goto err;
506503
507504 hist->dma_ch = NULL;
508505 dev_warn(isp->dev,
....@@ -518,9 +515,12 @@
518515 hist->event_type = V4L2_EVENT_OMAP3ISP_HIST;
519516
520517 ret = omap3isp_stat_init(hist, "histogram", &hist_subdev_ops);
518
+
519
+err:
521520 if (ret) {
522
- if (hist->dma_ch)
521
+ if (!IS_ERR_OR_NULL(hist->dma_ch))
523522 dma_release_channel(hist->dma_ch);
523
+ kfree(hist_cfg);
524524 }
525525
526526 return ret;