All of lore.kernel.org
 help / color / mirror / Atom feed
From: kernel test robot <lkp@intel.com>
To: kbuild@lists.01.org
Subject: drivers/media/platform/omap3isp/isphist.c:526 omap3isp_hist_init() warn: possible memory leak of 'hist_cfg'
Date: Fri, 26 Mar 2021 20:29:27 +0800	[thread overview]
Message-ID: <202103262021.UtORQ54p-lkp@intel.com> (raw)

[-- Attachment #1: Type: text/plain, Size: 8108 bytes --]

CC: kbuild-all(a)lists.01.org
CC: linux-kernel(a)vger.kernel.org
TO: Mauro Carvalho Chehab <mchehab@kernel.org>
CC: linux-media(a)vger.kernel.org

Hi Mauro,

First bad commit (maybe != root cause):

tree:   https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master
head:   db24726bfefa68c606947a86132591568a06bfb4
commit: a19f228b8dd9a67e8de4ebd4eac8a4c94ec39d1a media: Kconfig: not all V4L2 platform drivers are for camera
date:   12 months ago
:::::: branch date: 13 hours ago
:::::: commit date: 12 months ago
config: h8300-randconfig-m031-20210326 (attached as .config)
compiler: h8300-linux-gcc (GCC) 9.3.0

If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp@intel.com>
Reported-by: Dan Carpenter <dan.carpenter@oracle.com>

smatch warnings:
drivers/media/platform/omap3isp/isphist.c:526 omap3isp_hist_init() warn: possible memory leak of 'hist_cfg'

vim +/hist_cfg +526 drivers/media/platform/omap3isp/isphist.c

68e342b3068cae drivers/media/video/omap3isp/isphist.c    David Cohen      2011-02-12  470  
68e342b3068cae drivers/media/video/omap3isp/isphist.c    David Cohen      2011-02-12  471  /*
68e342b3068cae drivers/media/video/omap3isp/isphist.c    David Cohen      2011-02-12  472   * omap3isp_hist_init - Module Initialization.
68e342b3068cae drivers/media/video/omap3isp/isphist.c    David Cohen      2011-02-12  473   */
68e342b3068cae drivers/media/video/omap3isp/isphist.c    David Cohen      2011-02-12  474  int omap3isp_hist_init(struct isp_device *isp)
68e342b3068cae drivers/media/video/omap3isp/isphist.c    David Cohen      2011-02-12  475  {
68e342b3068cae drivers/media/video/omap3isp/isphist.c    David Cohen      2011-02-12  476  	struct ispstat *hist = &isp->isp_hist;
68e342b3068cae drivers/media/video/omap3isp/isphist.c    David Cohen      2011-02-12  477  	struct omap3isp_hist_config *hist_cfg;
814434984a5d20 drivers/media/platform/omap3isp/isphist.c Sakari Ailus     2017-07-13  478  	int ret;
68e342b3068cae drivers/media/video/omap3isp/isphist.c    David Cohen      2011-02-12  479  
814434984a5d20 drivers/media/platform/omap3isp/isphist.c Sakari Ailus     2017-07-13  480  	hist_cfg = kzalloc(sizeof(*hist_cfg), GFP_KERNEL);
68e342b3068cae drivers/media/video/omap3isp/isphist.c    David Cohen      2011-02-12  481  	if (hist_cfg == NULL)
68e342b3068cae drivers/media/video/omap3isp/isphist.c    David Cohen      2011-02-12  482  		return -ENOMEM;
68e342b3068cae drivers/media/video/omap3isp/isphist.c    David Cohen      2011-02-12  483  
d83501a0416160 drivers/media/platform/omap3isp/isphist.c Laurent Pinchart 2012-10-11  484  	hist->isp = isp;
d83501a0416160 drivers/media/platform/omap3isp/isphist.c Laurent Pinchart 2012-10-11  485  
0ff4e419dc6a40 drivers/media/platform/omap3isp/isphist.c Laurent Pinchart 2015-02-21  486  	if (HIST_CONFIG_DMA) {
0ff4e419dc6a40 drivers/media/platform/omap3isp/isphist.c Laurent Pinchart 2015-02-21  487  		dma_cap_mask_t mask;
0ff4e419dc6a40 drivers/media/platform/omap3isp/isphist.c Laurent Pinchart 2015-02-21  488  
a9943f6b6b77cf drivers/media/platform/omap3isp/isphist.c Peter Ujfalusi   2016-11-04  489  		/*
a9943f6b6b77cf drivers/media/platform/omap3isp/isphist.c Peter Ujfalusi   2016-11-04  490  		 * We need slave capable channel without DMA request line for
a9943f6b6b77cf drivers/media/platform/omap3isp/isphist.c Peter Ujfalusi   2016-11-04  491  		 * reading out the data.
a9943f6b6b77cf drivers/media/platform/omap3isp/isphist.c Peter Ujfalusi   2016-11-04  492  		 * For this we can use dma_request_chan_by_mask() as we are
a9943f6b6b77cf drivers/media/platform/omap3isp/isphist.c Peter Ujfalusi   2016-11-04  493  		 * happy with any channel as long as it is capable of slave
a9943f6b6b77cf drivers/media/platform/omap3isp/isphist.c Peter Ujfalusi   2016-11-04  494  		 * configuration.
a9943f6b6b77cf drivers/media/platform/omap3isp/isphist.c Peter Ujfalusi   2016-11-04  495  		 */
0ff4e419dc6a40 drivers/media/platform/omap3isp/isphist.c Laurent Pinchart 2015-02-21  496  		dma_cap_zero(mask);
0ff4e419dc6a40 drivers/media/platform/omap3isp/isphist.c Laurent Pinchart 2015-02-21  497  		dma_cap_set(DMA_SLAVE, mask);
a9943f6b6b77cf drivers/media/platform/omap3isp/isphist.c Peter Ujfalusi   2016-11-04  498  		hist->dma_ch = dma_request_chan_by_mask(&mask);
a9943f6b6b77cf drivers/media/platform/omap3isp/isphist.c Peter Ujfalusi   2016-11-04  499  		if (IS_ERR(hist->dma_ch)) {
a9943f6b6b77cf drivers/media/platform/omap3isp/isphist.c Peter Ujfalusi   2016-11-04  500  			ret = PTR_ERR(hist->dma_ch);
a9943f6b6b77cf drivers/media/platform/omap3isp/isphist.c Peter Ujfalusi   2016-11-04  501  			if (ret == -EPROBE_DEFER)
814434984a5d20 drivers/media/platform/omap3isp/isphist.c Sakari Ailus     2017-07-13  502  				goto err;
0ff4e419dc6a40 drivers/media/platform/omap3isp/isphist.c Laurent Pinchart 2015-02-21  503  
a9943f6b6b77cf drivers/media/platform/omap3isp/isphist.c Peter Ujfalusi   2016-11-04  504  			hist->dma_ch = NULL;
0ff4e419dc6a40 drivers/media/platform/omap3isp/isphist.c Laurent Pinchart 2015-02-21  505  			dev_warn(isp->dev,
0ff4e419dc6a40 drivers/media/platform/omap3isp/isphist.c Laurent Pinchart 2015-02-21  506  				 "hist: DMA channel request failed, using PIO\n");
a9943f6b6b77cf drivers/media/platform/omap3isp/isphist.c Peter Ujfalusi   2016-11-04  507  		} else {
0ff4e419dc6a40 drivers/media/platform/omap3isp/isphist.c Laurent Pinchart 2015-02-21  508  			dev_dbg(isp->dev, "hist: using DMA channel %s\n",
0ff4e419dc6a40 drivers/media/platform/omap3isp/isphist.c Laurent Pinchart 2015-02-21  509  				dma_chan_name(hist->dma_ch));
68e342b3068cae drivers/media/video/omap3isp/isphist.c    David Cohen      2011-02-12  510  		}
a9943f6b6b77cf drivers/media/platform/omap3isp/isphist.c Peter Ujfalusi   2016-11-04  511  	}
68e342b3068cae drivers/media/video/omap3isp/isphist.c    David Cohen      2011-02-12  512  
68e342b3068cae drivers/media/video/omap3isp/isphist.c    David Cohen      2011-02-12  513  	hist->ops = &hist_ops;
68e342b3068cae drivers/media/video/omap3isp/isphist.c    David Cohen      2011-02-12  514  	hist->priv = hist_cfg;
68e342b3068cae drivers/media/video/omap3isp/isphist.c    David Cohen      2011-02-12  515  	hist->event_type = V4L2_EVENT_OMAP3ISP_HIST;
68e342b3068cae drivers/media/video/omap3isp/isphist.c    David Cohen      2011-02-12  516  
68e342b3068cae drivers/media/video/omap3isp/isphist.c    David Cohen      2011-02-12  517  	ret = omap3isp_stat_init(hist, "histogram", &hist_subdev_ops);
814434984a5d20 drivers/media/platform/omap3isp/isphist.c Sakari Ailus     2017-07-13  518  
814434984a5d20 drivers/media/platform/omap3isp/isphist.c Sakari Ailus     2017-07-13  519  err:
68e342b3068cae drivers/media/video/omap3isp/isphist.c    David Cohen      2011-02-12  520  	if (ret) {
814434984a5d20 drivers/media/platform/omap3isp/isphist.c Sakari Ailus     2017-07-13  521  		if (!IS_ERR_OR_NULL(hist->dma_ch))
0ff4e419dc6a40 drivers/media/platform/omap3isp/isphist.c Laurent Pinchart 2015-02-21  522  			dma_release_channel(hist->dma_ch);
814434984a5d20 drivers/media/platform/omap3isp/isphist.c Sakari Ailus     2017-07-13  523  		kfree(hist_cfg);
68e342b3068cae drivers/media/video/omap3isp/isphist.c    David Cohen      2011-02-12  524  	}
68e342b3068cae drivers/media/video/omap3isp/isphist.c    David Cohen      2011-02-12  525  
68e342b3068cae drivers/media/video/omap3isp/isphist.c    David Cohen      2011-02-12 @526  	return ret;
68e342b3068cae drivers/media/video/omap3isp/isphist.c    David Cohen      2011-02-12  527  }
68e342b3068cae drivers/media/video/omap3isp/isphist.c    David Cohen      2011-02-12  528  

:::::: The code at line 526 was first introduced by commit
:::::: 68e342b3068cae62f3378cb4a1d385734ea52784 [media] omap3isp: Statistics

:::::: TO: David Cohen <dacohen@gmail.com>
:::::: CC: Mauro Carvalho Chehab <mchehab@redhat.com>

---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all(a)lists.01.org

[-- Attachment #2: config.gz --]
[-- Type: application/gzip, Size: 33146 bytes --]

             reply	other threads:[~2021-03-26 12:29 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-03-26 12:29 kernel test robot [this message]
  -- strict thread matches above, loose matches on Subject: below --
2021-01-26 11:45 drivers/media/platform/omap3isp/isphist.c:526 omap3isp_hist_init() warn: possible memory leak of 'hist_cfg' kernel test robot

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=202103262021.UtORQ54p-lkp@intel.com \
    --to=lkp@intel.com \
    --cc=kbuild@lists.01.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.