| .. | .. |
|---|
| 1 | +// SPDX-License-Identifier: GPL-2.0-only |
|---|
| 1 | 2 | /* |
|---|
| 2 | 3 | * isphist.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/delay.h> |
|---|
| .. | .. |
|---|
| 478 | 475 | { |
|---|
| 479 | 476 | struct ispstat *hist = &isp->isp_hist; |
|---|
| 480 | 477 | struct omap3isp_hist_config *hist_cfg; |
|---|
| 481 | | - int ret = -1; |
|---|
| 478 | + int ret; |
|---|
| 482 | 479 | |
|---|
| 483 | | - hist_cfg = devm_kzalloc(isp->dev, sizeof(*hist_cfg), GFP_KERNEL); |
|---|
| 480 | + hist_cfg = kzalloc(sizeof(*hist_cfg), GFP_KERNEL); |
|---|
| 484 | 481 | if (hist_cfg == NULL) |
|---|
| 485 | 482 | return -ENOMEM; |
|---|
| 486 | 483 | |
|---|
| .. | .. |
|---|
| 502 | 499 | if (IS_ERR(hist->dma_ch)) { |
|---|
| 503 | 500 | ret = PTR_ERR(hist->dma_ch); |
|---|
| 504 | 501 | if (ret == -EPROBE_DEFER) |
|---|
| 505 | | - return ret; |
|---|
| 502 | + goto err; |
|---|
| 506 | 503 | |
|---|
| 507 | 504 | hist->dma_ch = NULL; |
|---|
| 508 | 505 | dev_warn(isp->dev, |
|---|
| .. | .. |
|---|
| 518 | 515 | hist->event_type = V4L2_EVENT_OMAP3ISP_HIST; |
|---|
| 519 | 516 | |
|---|
| 520 | 517 | ret = omap3isp_stat_init(hist, "histogram", &hist_subdev_ops); |
|---|
| 518 | + |
|---|
| 519 | +err: |
|---|
| 521 | 520 | if (ret) { |
|---|
| 522 | | - if (hist->dma_ch) |
|---|
| 521 | + if (!IS_ERR_OR_NULL(hist->dma_ch)) |
|---|
| 523 | 522 | dma_release_channel(hist->dma_ch); |
|---|
| 523 | + kfree(hist_cfg); |
|---|
| 524 | 524 | } |
|---|
| 525 | 525 | |
|---|
| 526 | 526 | return ret; |
|---|