hc
2023-12-11 d2ccde1c8e90d38cee87a1b0309ad2827f3fd30d
kernel/drivers/media/platform/omap3isp/isph3a_af.c
....@@ -1,3 +1,4 @@
1
+// SPDX-License-Identifier: GPL-2.0-only
12 /*
23 * isph3a_af.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 /* Linux specific include files */
....@@ -354,9 +351,10 @@
354351 {
355352 struct ispstat *af = &isp->isp_af;
356353 struct omap3isp_h3a_af_config *af_cfg;
357
- struct omap3isp_h3a_af_config *af_recover_cfg;
354
+ struct omap3isp_h3a_af_config *af_recover_cfg = NULL;
355
+ int ret;
358356
359
- af_cfg = devm_kzalloc(isp->dev, sizeof(*af_cfg), GFP_KERNEL);
357
+ af_cfg = kzalloc(sizeof(*af_cfg), GFP_KERNEL);
360358 if (af_cfg == NULL)
361359 return -ENOMEM;
362360
....@@ -366,12 +364,12 @@
366364 af->isp = isp;
367365
368366 /* Set recover state configuration */
369
- af_recover_cfg = devm_kzalloc(isp->dev, sizeof(*af_recover_cfg),
370
- GFP_KERNEL);
367
+ af_recover_cfg = kzalloc(sizeof(*af_recover_cfg), GFP_KERNEL);
371368 if (!af_recover_cfg) {
372369 dev_err(af->isp->dev,
373370 "AF: cannot allocate memory for recover configuration.\n");
374
- return -ENOMEM;
371
+ ret = -ENOMEM;
372
+ goto err;
375373 }
376374
377375 af_recover_cfg->paxel.h_start = OMAP3ISP_AF_PAXEL_HZSTART_MIN;
....@@ -383,13 +381,22 @@
383381 if (h3a_af_validate_params(af, af_recover_cfg)) {
384382 dev_err(af->isp->dev,
385383 "AF: recover configuration is invalid.\n");
386
- return -EINVAL;
384
+ ret = -EINVAL;
385
+ goto err;
387386 }
388387
389388 af_recover_cfg->buf_size = h3a_af_get_buf_size(af_recover_cfg);
390389 af->recover_priv = af_recover_cfg;
391390
392
- return omap3isp_stat_init(af, "AF", &h3a_af_subdev_ops);
391
+ ret = omap3isp_stat_init(af, "AF", &h3a_af_subdev_ops);
392
+
393
+err:
394
+ if (ret) {
395
+ kfree(af_cfg);
396
+ kfree(af_recover_cfg);
397
+ }
398
+
399
+ return ret;
393400 }
394401
395402 void omap3isp_h3a_af_cleanup(struct isp_device *isp)