.. | .. |
---|
| 1 | +// SPDX-License-Identifier: GPL-2.0-only |
---|
1 | 2 | /* |
---|
2 | 3 | * isph3a.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 | #include <linux/slab.h> |
---|
.. | .. |
---|
291 | 288 | { |
---|
292 | 289 | struct ispstat *aewb = &isp->isp_aewb; |
---|
293 | 290 | struct omap3isp_h3a_aewb_config *aewb_cfg; |
---|
294 | | - struct omap3isp_h3a_aewb_config *aewb_recover_cfg; |
---|
| 291 | + struct omap3isp_h3a_aewb_config *aewb_recover_cfg = NULL; |
---|
| 292 | + int ret; |
---|
295 | 293 | |
---|
296 | | - aewb_cfg = devm_kzalloc(isp->dev, sizeof(*aewb_cfg), GFP_KERNEL); |
---|
| 294 | + aewb_cfg = kzalloc(sizeof(*aewb_cfg), GFP_KERNEL); |
---|
297 | 295 | if (!aewb_cfg) |
---|
298 | 296 | return -ENOMEM; |
---|
299 | 297 | |
---|
.. | .. |
---|
303 | 301 | aewb->isp = isp; |
---|
304 | 302 | |
---|
305 | 303 | /* Set recover state configuration */ |
---|
306 | | - aewb_recover_cfg = devm_kzalloc(isp->dev, sizeof(*aewb_recover_cfg), |
---|
307 | | - GFP_KERNEL); |
---|
| 304 | + aewb_recover_cfg = kzalloc(sizeof(*aewb_recover_cfg), GFP_KERNEL); |
---|
308 | 305 | if (!aewb_recover_cfg) { |
---|
309 | 306 | dev_err(aewb->isp->dev, |
---|
310 | 307 | "AEWB: cannot allocate memory for recover configuration.\n"); |
---|
311 | | - return -ENOMEM; |
---|
| 308 | + ret = -ENOMEM; |
---|
| 309 | + goto err; |
---|
312 | 310 | } |
---|
313 | 311 | |
---|
314 | 312 | aewb_recover_cfg->saturation_limit = OMAP3ISP_AEWB_MAX_SATURATION_LIM; |
---|
.. | .. |
---|
325 | 323 | if (h3a_aewb_validate_params(aewb, aewb_recover_cfg)) { |
---|
326 | 324 | dev_err(aewb->isp->dev, |
---|
327 | 325 | "AEWB: recover configuration is invalid.\n"); |
---|
328 | | - return -EINVAL; |
---|
| 326 | + ret = -EINVAL; |
---|
| 327 | + goto err; |
---|
329 | 328 | } |
---|
330 | 329 | |
---|
331 | 330 | aewb_recover_cfg->buf_size = h3a_aewb_get_buf_size(aewb_recover_cfg); |
---|
332 | 331 | aewb->recover_priv = aewb_recover_cfg; |
---|
333 | 332 | |
---|
334 | | - return omap3isp_stat_init(aewb, "AEWB", &h3a_aewb_subdev_ops); |
---|
| 333 | + ret = omap3isp_stat_init(aewb, "AEWB", &h3a_aewb_subdev_ops); |
---|
| 334 | + |
---|
| 335 | +err: |
---|
| 336 | + if (ret) { |
---|
| 337 | + kfree(aewb_cfg); |
---|
| 338 | + kfree(aewb_recover_cfg); |
---|
| 339 | + } |
---|
| 340 | + |
---|
| 341 | + return ret; |
---|
335 | 342 | } |
---|
336 | 343 | |
---|
337 | 344 | /* |
---|