All of lore.kernel.org
 help / color / mirror / Atom feed
From: Dan Carpenter <dan.carpenter@oracle.com>
To: kbuild@lists.01.org
Subject: drivers/power/reset/at91-reset.c:260 at91_reset_probe() warn: 'reset->rstc_base' not released on lines: 244.
Date: Mon, 08 Feb 2021 16:23:15 +0300	[thread overview]
Message-ID: <20210208132315.GF2696@kadam> (raw)

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

tree:   https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master
head:   61556703b610a104de324e4f061dc6cf7b218b46
commit: b7967b7919f0e3787d6e23424b5ad367fbb937e2 power: reset: at91-reset: convert reset in pointer to struct at91_reset
config: arm-randconfig-m031-20210206 (attached as .config)
compiler: arm-linux-gnueabi-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/power/reset/at91-reset.c:260 at91_reset_probe() warn: 'reset->rstc_base' not released on lines: 244.

vim +260 drivers/power/reset/at91-reset.c

6e64180a7c0219 Alexandre Belloni            2015-08-11  209  static int __init at91_reset_probe(struct platform_device *pdev)
ecfe64d8c55f8f Maxime Ripard                2014-07-02  210  {
ecfe64d8c55f8f Maxime Ripard                2014-07-02  211  	const struct of_device_id *match;
ecfe64d8c55f8f Maxime Ripard                2014-07-02  212  	struct device_node *np;
eacd8d09db7f45 Alexandre Belloni            2015-08-11  213  	int ret, idx = 0;
ecfe64d8c55f8f Maxime Ripard                2014-07-02  214  
b7967b7919f0e3 Claudiu.Beznea(a)microchip.com 2020-01-21  215  	reset = devm_kzalloc(&pdev->dev, sizeof(*reset), GFP_KERNEL);
b7967b7919f0e3 Claudiu.Beznea(a)microchip.com 2020-01-21  216  	if (!reset)
b7967b7919f0e3 Claudiu.Beznea(a)microchip.com 2020-01-21  217  		return -ENOMEM;
b7967b7919f0e3 Claudiu.Beznea(a)microchip.com 2020-01-21  218  
b7967b7919f0e3 Claudiu.Beznea(a)microchip.com 2020-01-21  219  	reset->rstc_base = of_iomap(pdev->dev.of_node, 0);
b7967b7919f0e3 Claudiu.Beznea(a)microchip.com 2020-01-21  220  	if (!reset->rstc_base) {
ecfe64d8c55f8f Maxime Ripard                2014-07-02  221  		dev_err(&pdev->dev, "Could not map reset controller address\n");
ecfe64d8c55f8f Maxime Ripard                2014-07-02  222  		return -ENODEV;
ecfe64d8c55f8f Maxime Ripard                2014-07-02  223  	}
ecfe64d8c55f8f Maxime Ripard                2014-07-02  224  
1ae25d626cfe7e Josh Wu                      2015-07-20  225  	if (!of_device_is_compatible(pdev->dev.of_node, "atmel,sama5d3-rstc")) {
1ae25d626cfe7e Josh Wu                      2015-07-20  226  		/* we need to shutdown the ddr controller, so get ramc base */
ecfe64d8c55f8f Maxime Ripard                2014-07-02  227  		for_each_matching_node(np, at91_ramc_of_match) {
b7967b7919f0e3 Claudiu.Beznea(a)microchip.com 2020-01-21  228  			reset->ramc_base[idx] = of_iomap(np, 0);
b7967b7919f0e3 Claudiu.Beznea(a)microchip.com 2020-01-21  229  			if (!reset->ramc_base[idx]) {
ecfe64d8c55f8f Maxime Ripard                2014-07-02  230  				dev_err(&pdev->dev, "Could not map ram controller address\n");
c4c0edfbf875a5 Julia Lawall                 2015-11-18  231  				of_node_put(np);
ecfe64d8c55f8f Maxime Ripard                2014-07-02  232  				return -ENODEV;

These error paths should probably unmap "reset->rstc_base"?

ecfe64d8c55f8f Maxime Ripard                2014-07-02  233  			}
ecfe64d8c55f8f Maxime Ripard                2014-07-02  234  			idx++;
ecfe64d8c55f8f Maxime Ripard                2014-07-02  235  		}
1ae25d626cfe7e Josh Wu                      2015-07-20  236  	}
ecfe64d8c55f8f Maxime Ripard                2014-07-02  237  
ecfe64d8c55f8f Maxime Ripard                2014-07-02  238  	match = of_match_node(at91_reset_of_match, pdev->dev.of_node);
b7967b7919f0e3 Claudiu.Beznea(a)microchip.com 2020-01-21  239  	reset->nb.notifier_call = match->data;
b7967b7919f0e3 Claudiu.Beznea(a)microchip.com 2020-01-21  240  	reset->nb.priority = 192;
ecfe64d8c55f8f Maxime Ripard                2014-07-02  241  
b7967b7919f0e3 Claudiu.Beznea(a)microchip.com 2020-01-21  242  	reset->sclk = devm_clk_get(&pdev->dev, NULL);
b7967b7919f0e3 Claudiu.Beznea(a)microchip.com 2020-01-21  243  	if (IS_ERR(reset->sclk))
b7967b7919f0e3 Claudiu.Beznea(a)microchip.com 2020-01-21  244  		return PTR_ERR(reset->sclk);

Etc.  These should probably unmap reset->ramc_base[].

2b2c6148fe8510 Alexandre Belloni            2015-08-11  245  
b7967b7919f0e3 Claudiu.Beznea(a)microchip.com 2020-01-21  246  	ret = clk_prepare_enable(reset->sclk);
2b2c6148fe8510 Alexandre Belloni            2015-08-11  247  	if (ret) {
2b2c6148fe8510 Alexandre Belloni            2015-08-11  248  		dev_err(&pdev->dev, "Could not enable slow clock\n");
2b2c6148fe8510 Alexandre Belloni            2015-08-11  249  		return ret;
2b2c6148fe8510 Alexandre Belloni            2015-08-11  250  	}
2b2c6148fe8510 Alexandre Belloni            2015-08-11  251  
b7967b7919f0e3 Claudiu.Beznea(a)microchip.com 2020-01-21  252  	ret = register_restart_handler(&reset->nb);
2b2c6148fe8510 Alexandre Belloni            2015-08-11  253  	if (ret) {
b7967b7919f0e3 Claudiu.Beznea(a)microchip.com 2020-01-21  254  		clk_disable_unprepare(reset->sclk);
ecfe64d8c55f8f Maxime Ripard                2014-07-02  255  		return ret;
2b2c6148fe8510 Alexandre Belloni            2015-08-11  256  	}
ecfe64d8c55f8f Maxime Ripard                2014-07-02  257  
ecfe64d8c55f8f Maxime Ripard                2014-07-02  258  	at91_reset_status(pdev);
ecfe64d8c55f8f Maxime Ripard                2014-07-02  259  
ecfe64d8c55f8f Maxime Ripard                2014-07-02 @260  	return 0;
ecfe64d8c55f8f Maxime Ripard                2014-07-02  261  }

---
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: 23054 bytes --]

WARNING: multiple messages have this Message-ID (diff)
From: Dan Carpenter <dan.carpenter@oracle.com>
To: kbuild-all@lists.01.org
Subject: drivers/power/reset/at91-reset.c:260 at91_reset_probe() warn: 'reset->rstc_base' not released on lines: 244.
Date: Mon, 08 Feb 2021 16:23:15 +0300	[thread overview]
Message-ID: <20210208132315.GF2696@kadam> (raw)

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

tree:   https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master
head:   61556703b610a104de324e4f061dc6cf7b218b46
commit: b7967b7919f0e3787d6e23424b5ad367fbb937e2 power: reset: at91-reset: convert reset in pointer to struct at91_reset
config: arm-randconfig-m031-20210206 (attached as .config)
compiler: arm-linux-gnueabi-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/power/reset/at91-reset.c:260 at91_reset_probe() warn: 'reset->rstc_base' not released on lines: 244.

vim +260 drivers/power/reset/at91-reset.c

6e64180a7c0219 Alexandre Belloni            2015-08-11  209  static int __init at91_reset_probe(struct platform_device *pdev)
ecfe64d8c55f8f Maxime Ripard                2014-07-02  210  {
ecfe64d8c55f8f Maxime Ripard                2014-07-02  211  	const struct of_device_id *match;
ecfe64d8c55f8f Maxime Ripard                2014-07-02  212  	struct device_node *np;
eacd8d09db7f45 Alexandre Belloni            2015-08-11  213  	int ret, idx = 0;
ecfe64d8c55f8f Maxime Ripard                2014-07-02  214  
b7967b7919f0e3 Claudiu.Beznea(a)microchip.com 2020-01-21  215  	reset = devm_kzalloc(&pdev->dev, sizeof(*reset), GFP_KERNEL);
b7967b7919f0e3 Claudiu.Beznea(a)microchip.com 2020-01-21  216  	if (!reset)
b7967b7919f0e3 Claudiu.Beznea(a)microchip.com 2020-01-21  217  		return -ENOMEM;
b7967b7919f0e3 Claudiu.Beznea(a)microchip.com 2020-01-21  218  
b7967b7919f0e3 Claudiu.Beznea(a)microchip.com 2020-01-21  219  	reset->rstc_base = of_iomap(pdev->dev.of_node, 0);
b7967b7919f0e3 Claudiu.Beznea(a)microchip.com 2020-01-21  220  	if (!reset->rstc_base) {
ecfe64d8c55f8f Maxime Ripard                2014-07-02  221  		dev_err(&pdev->dev, "Could not map reset controller address\n");
ecfe64d8c55f8f Maxime Ripard                2014-07-02  222  		return -ENODEV;
ecfe64d8c55f8f Maxime Ripard                2014-07-02  223  	}
ecfe64d8c55f8f Maxime Ripard                2014-07-02  224  
1ae25d626cfe7e Josh Wu                      2015-07-20  225  	if (!of_device_is_compatible(pdev->dev.of_node, "atmel,sama5d3-rstc")) {
1ae25d626cfe7e Josh Wu                      2015-07-20  226  		/* we need to shutdown the ddr controller, so get ramc base */
ecfe64d8c55f8f Maxime Ripard                2014-07-02  227  		for_each_matching_node(np, at91_ramc_of_match) {
b7967b7919f0e3 Claudiu.Beznea(a)microchip.com 2020-01-21  228  			reset->ramc_base[idx] = of_iomap(np, 0);
b7967b7919f0e3 Claudiu.Beznea(a)microchip.com 2020-01-21  229  			if (!reset->ramc_base[idx]) {
ecfe64d8c55f8f Maxime Ripard                2014-07-02  230  				dev_err(&pdev->dev, "Could not map ram controller address\n");
c4c0edfbf875a5 Julia Lawall                 2015-11-18  231  				of_node_put(np);
ecfe64d8c55f8f Maxime Ripard                2014-07-02  232  				return -ENODEV;

These error paths should probably unmap "reset->rstc_base"?

ecfe64d8c55f8f Maxime Ripard                2014-07-02  233  			}
ecfe64d8c55f8f Maxime Ripard                2014-07-02  234  			idx++;
ecfe64d8c55f8f Maxime Ripard                2014-07-02  235  		}
1ae25d626cfe7e Josh Wu                      2015-07-20  236  	}
ecfe64d8c55f8f Maxime Ripard                2014-07-02  237  
ecfe64d8c55f8f Maxime Ripard                2014-07-02  238  	match = of_match_node(at91_reset_of_match, pdev->dev.of_node);
b7967b7919f0e3 Claudiu.Beznea(a)microchip.com 2020-01-21  239  	reset->nb.notifier_call = match->data;
b7967b7919f0e3 Claudiu.Beznea(a)microchip.com 2020-01-21  240  	reset->nb.priority = 192;
ecfe64d8c55f8f Maxime Ripard                2014-07-02  241  
b7967b7919f0e3 Claudiu.Beznea(a)microchip.com 2020-01-21  242  	reset->sclk = devm_clk_get(&pdev->dev, NULL);
b7967b7919f0e3 Claudiu.Beznea(a)microchip.com 2020-01-21  243  	if (IS_ERR(reset->sclk))
b7967b7919f0e3 Claudiu.Beznea(a)microchip.com 2020-01-21  244  		return PTR_ERR(reset->sclk);

Etc.  These should probably unmap reset->ramc_base[].

2b2c6148fe8510 Alexandre Belloni            2015-08-11  245  
b7967b7919f0e3 Claudiu.Beznea(a)microchip.com 2020-01-21  246  	ret = clk_prepare_enable(reset->sclk);
2b2c6148fe8510 Alexandre Belloni            2015-08-11  247  	if (ret) {
2b2c6148fe8510 Alexandre Belloni            2015-08-11  248  		dev_err(&pdev->dev, "Could not enable slow clock\n");
2b2c6148fe8510 Alexandre Belloni            2015-08-11  249  		return ret;
2b2c6148fe8510 Alexandre Belloni            2015-08-11  250  	}
2b2c6148fe8510 Alexandre Belloni            2015-08-11  251  
b7967b7919f0e3 Claudiu.Beznea(a)microchip.com 2020-01-21  252  	ret = register_restart_handler(&reset->nb);
2b2c6148fe8510 Alexandre Belloni            2015-08-11  253  	if (ret) {
b7967b7919f0e3 Claudiu.Beznea(a)microchip.com 2020-01-21  254  		clk_disable_unprepare(reset->sclk);
ecfe64d8c55f8f Maxime Ripard                2014-07-02  255  		return ret;
2b2c6148fe8510 Alexandre Belloni            2015-08-11  256  	}
ecfe64d8c55f8f Maxime Ripard                2014-07-02  257  
ecfe64d8c55f8f Maxime Ripard                2014-07-02  258  	at91_reset_status(pdev);
ecfe64d8c55f8f Maxime Ripard                2014-07-02  259  
ecfe64d8c55f8f Maxime Ripard                2014-07-02 @260  	return 0;
ecfe64d8c55f8f Maxime Ripard                2014-07-02  261  }

---
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: 23054 bytes --]

WARNING: multiple messages have this Message-ID (diff)
From: Dan Carpenter <dan.carpenter@oracle.com>
To: kbuild@lists.01.org, "Claudiu.Beznea" <Claudiu.Beznea@microchip.com>
Cc: lkp@intel.com, kbuild-all@lists.01.org,
	linux-kernel@vger.kernel.org,
	Sebastian Reichel <sebastian.reichel@collabora.com>,
	Claudiu Beznea <claudiu.beznea@microchip.com>
Subject: drivers/power/reset/at91-reset.c:260 at91_reset_probe() warn: 'reset->rstc_base' not released on lines: 244.
Date: Mon, 8 Feb 2021 16:23:15 +0300	[thread overview]
Message-ID: <20210208132315.GF2696@kadam> (raw)

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

tree:   https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master
head:   61556703b610a104de324e4f061dc6cf7b218b46
commit: b7967b7919f0e3787d6e23424b5ad367fbb937e2 power: reset: at91-reset: convert reset in pointer to struct at91_reset
config: arm-randconfig-m031-20210206 (attached as .config)
compiler: arm-linux-gnueabi-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/power/reset/at91-reset.c:260 at91_reset_probe() warn: 'reset->rstc_base' not released on lines: 244.

vim +260 drivers/power/reset/at91-reset.c

6e64180a7c0219 Alexandre Belloni            2015-08-11  209  static int __init at91_reset_probe(struct platform_device *pdev)
ecfe64d8c55f8f Maxime Ripard                2014-07-02  210  {
ecfe64d8c55f8f Maxime Ripard                2014-07-02  211  	const struct of_device_id *match;
ecfe64d8c55f8f Maxime Ripard                2014-07-02  212  	struct device_node *np;
eacd8d09db7f45 Alexandre Belloni            2015-08-11  213  	int ret, idx = 0;
ecfe64d8c55f8f Maxime Ripard                2014-07-02  214  
b7967b7919f0e3 Claudiu.Beznea@microchip.com 2020-01-21  215  	reset = devm_kzalloc(&pdev->dev, sizeof(*reset), GFP_KERNEL);
b7967b7919f0e3 Claudiu.Beznea@microchip.com 2020-01-21  216  	if (!reset)
b7967b7919f0e3 Claudiu.Beznea@microchip.com 2020-01-21  217  		return -ENOMEM;
b7967b7919f0e3 Claudiu.Beznea@microchip.com 2020-01-21  218  
b7967b7919f0e3 Claudiu.Beznea@microchip.com 2020-01-21  219  	reset->rstc_base = of_iomap(pdev->dev.of_node, 0);
b7967b7919f0e3 Claudiu.Beznea@microchip.com 2020-01-21  220  	if (!reset->rstc_base) {
ecfe64d8c55f8f Maxime Ripard                2014-07-02  221  		dev_err(&pdev->dev, "Could not map reset controller address\n");
ecfe64d8c55f8f Maxime Ripard                2014-07-02  222  		return -ENODEV;
ecfe64d8c55f8f Maxime Ripard                2014-07-02  223  	}
ecfe64d8c55f8f Maxime Ripard                2014-07-02  224  
1ae25d626cfe7e Josh Wu                      2015-07-20  225  	if (!of_device_is_compatible(pdev->dev.of_node, "atmel,sama5d3-rstc")) {
1ae25d626cfe7e Josh Wu                      2015-07-20  226  		/* we need to shutdown the ddr controller, so get ramc base */
ecfe64d8c55f8f Maxime Ripard                2014-07-02  227  		for_each_matching_node(np, at91_ramc_of_match) {
b7967b7919f0e3 Claudiu.Beznea@microchip.com 2020-01-21  228  			reset->ramc_base[idx] = of_iomap(np, 0);
b7967b7919f0e3 Claudiu.Beznea@microchip.com 2020-01-21  229  			if (!reset->ramc_base[idx]) {
ecfe64d8c55f8f Maxime Ripard                2014-07-02  230  				dev_err(&pdev->dev, "Could not map ram controller address\n");
c4c0edfbf875a5 Julia Lawall                 2015-11-18  231  				of_node_put(np);
ecfe64d8c55f8f Maxime Ripard                2014-07-02  232  				return -ENODEV;

These error paths should probably unmap "reset->rstc_base"?

ecfe64d8c55f8f Maxime Ripard                2014-07-02  233  			}
ecfe64d8c55f8f Maxime Ripard                2014-07-02  234  			idx++;
ecfe64d8c55f8f Maxime Ripard                2014-07-02  235  		}
1ae25d626cfe7e Josh Wu                      2015-07-20  236  	}
ecfe64d8c55f8f Maxime Ripard                2014-07-02  237  
ecfe64d8c55f8f Maxime Ripard                2014-07-02  238  	match = of_match_node(at91_reset_of_match, pdev->dev.of_node);
b7967b7919f0e3 Claudiu.Beznea@microchip.com 2020-01-21  239  	reset->nb.notifier_call = match->data;
b7967b7919f0e3 Claudiu.Beznea@microchip.com 2020-01-21  240  	reset->nb.priority = 192;
ecfe64d8c55f8f Maxime Ripard                2014-07-02  241  
b7967b7919f0e3 Claudiu.Beznea@microchip.com 2020-01-21  242  	reset->sclk = devm_clk_get(&pdev->dev, NULL);
b7967b7919f0e3 Claudiu.Beznea@microchip.com 2020-01-21  243  	if (IS_ERR(reset->sclk))
b7967b7919f0e3 Claudiu.Beznea@microchip.com 2020-01-21  244  		return PTR_ERR(reset->sclk);

Etc.  These should probably unmap reset->ramc_base[].

2b2c6148fe8510 Alexandre Belloni            2015-08-11  245  
b7967b7919f0e3 Claudiu.Beznea@microchip.com 2020-01-21  246  	ret = clk_prepare_enable(reset->sclk);
2b2c6148fe8510 Alexandre Belloni            2015-08-11  247  	if (ret) {
2b2c6148fe8510 Alexandre Belloni            2015-08-11  248  		dev_err(&pdev->dev, "Could not enable slow clock\n");
2b2c6148fe8510 Alexandre Belloni            2015-08-11  249  		return ret;
2b2c6148fe8510 Alexandre Belloni            2015-08-11  250  	}
2b2c6148fe8510 Alexandre Belloni            2015-08-11  251  
b7967b7919f0e3 Claudiu.Beznea@microchip.com 2020-01-21  252  	ret = register_restart_handler(&reset->nb);
2b2c6148fe8510 Alexandre Belloni            2015-08-11  253  	if (ret) {
b7967b7919f0e3 Claudiu.Beznea@microchip.com 2020-01-21  254  		clk_disable_unprepare(reset->sclk);
ecfe64d8c55f8f Maxime Ripard                2014-07-02  255  		return ret;
2b2c6148fe8510 Alexandre Belloni            2015-08-11  256  	}
ecfe64d8c55f8f Maxime Ripard                2014-07-02  257  
ecfe64d8c55f8f Maxime Ripard                2014-07-02  258  	at91_reset_status(pdev);
ecfe64d8c55f8f Maxime Ripard                2014-07-02  259  
ecfe64d8c55f8f Maxime Ripard                2014-07-02 @260  	return 0;
ecfe64d8c55f8f Maxime Ripard                2014-07-02  261  }

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

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

             reply	other threads:[~2021-02-08 13:23 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-02-08 13:23 Dan Carpenter [this message]
2021-02-08 13:23 ` drivers/power/reset/at91-reset.c:260 at91_reset_probe() warn: 'reset->rstc_base' not released on lines: 244 Dan Carpenter
2021-02-08 13:23 ` Dan Carpenter
  -- strict thread matches above, loose matches on Subject: below --
2021-02-06  7:35 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=20210208132315.GF2696@kadam \
    --to=dan.carpenter@oracle.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.