.. | .. |
---|
| 1 | +// SPDX-License-Identifier: GPL-2.0-only |
---|
1 | 2 | /* |
---|
2 | 3 | * isph3a_af.c |
---|
3 | 4 | * |
---|
.. | .. |
---|
9 | 10 | * Contacts: David Cohen <dacohen@gmail.com> |
---|
10 | 11 | * Laurent Pinchart <laurent.pinchart@ideasonboard.com> |
---|
11 | 12 | * 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. |
---|
16 | 13 | */ |
---|
17 | 14 | |
---|
18 | 15 | /* Linux specific include files */ |
---|
.. | .. |
---|
354 | 351 | { |
---|
355 | 352 | struct ispstat *af = &isp->isp_af; |
---|
356 | 353 | 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; |
---|
358 | 356 | |
---|
359 | | - af_cfg = devm_kzalloc(isp->dev, sizeof(*af_cfg), GFP_KERNEL); |
---|
| 357 | + af_cfg = kzalloc(sizeof(*af_cfg), GFP_KERNEL); |
---|
360 | 358 | if (af_cfg == NULL) |
---|
361 | 359 | return -ENOMEM; |
---|
362 | 360 | |
---|
.. | .. |
---|
366 | 364 | af->isp = isp; |
---|
367 | 365 | |
---|
368 | 366 | /* 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); |
---|
371 | 368 | if (!af_recover_cfg) { |
---|
372 | 369 | dev_err(af->isp->dev, |
---|
373 | 370 | "AF: cannot allocate memory for recover configuration.\n"); |
---|
374 | | - return -ENOMEM; |
---|
| 371 | + ret = -ENOMEM; |
---|
| 372 | + goto err; |
---|
375 | 373 | } |
---|
376 | 374 | |
---|
377 | 375 | af_recover_cfg->paxel.h_start = OMAP3ISP_AF_PAXEL_HZSTART_MIN; |
---|
.. | .. |
---|
383 | 381 | if (h3a_af_validate_params(af, af_recover_cfg)) { |
---|
384 | 382 | dev_err(af->isp->dev, |
---|
385 | 383 | "AF: recover configuration is invalid.\n"); |
---|
386 | | - return -EINVAL; |
---|
| 384 | + ret = -EINVAL; |
---|
| 385 | + goto err; |
---|
387 | 386 | } |
---|
388 | 387 | |
---|
389 | 388 | af_recover_cfg->buf_size = h3a_af_get_buf_size(af_recover_cfg); |
---|
390 | 389 | af->recover_priv = af_recover_cfg; |
---|
391 | 390 | |
---|
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; |
---|
393 | 400 | } |
---|
394 | 401 | |
---|
395 | 402 | void omap3isp_h3a_af_cleanup(struct isp_device *isp) |
---|