Bug 25022 - [cppcheck] function returns not intialized variable in linux-2.6/arch/arm/mach-omap2/pm44xx.c
Summary: [cppcheck] function returns not intialized variable in linux-2.6/arch/arm/mac...
Status: CLOSED CODE_FIX
Alias: None
Product: Platform Specific/Hardware
Classification: Unclassified
Component: ARM (show other bugs)
Hardware: All Linux
: P1 normal
Assignee: linux-arm-kernel@lists.arm.linux.org.uk
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2010-12-16 21:00 UTC by Martin Ettl
Modified: 2012-06-13 14:59 UTC (History)
3 users (show)

See Also:
Kernel Version: 2.6-git head
Subsystem:
Regression: No
Bisected commit-id:


Attachments

Description Martin Ettl 2010-12-16 21:00:42 UTC
during a check of the current git head of the linux kernel with the static code
analysis tool cppcheck (http://sourceforge.net/apps/mediawiki/cppcheck/index.php?title=Main_Page) the tool discovered a not initialized variable in linux-2.6/arch/arm/mach-omap2/pm44xx.c. This happens if the preprocessor command -DCONFIG_PM and -DCONFIG_SUSPEND is not set!


Here is the code snippet to illustrate:

static int __init omap4_pm_init(void)
{
	int ret;

	if (!cpu_is_omap44xx())
		return -ENODEV;

	pr_err("Power Management for TI OMAP4.\n");

#ifdef CONFIG_PM
	ret = pwrdm_for_each(pwrdms_setup, NULL);
	if (ret) {
		pr_err("Failed to setup powerdomains\n");
		goto err2;
	}
#endif

#ifdef CONFIG_SUSPEND
	suspend_set_ops(&omap_pm_ops);
#endif /* CONFIG_SUSPEND */

err2:
	return ret;
}


Best regards

Ettl Martin
Comment 1 Nishanth Menon 2011-03-13 03:40:32 UTC
posted patch - http://marc.info/?l=linux-omap&m=129998746402420&w=2
Comment 2 Florian Mickler 2011-05-30 08:09:24 UTC
A patch referencing this bug report has been merged in v3.0-rc1:

commit 34549009a1a48e9212508aa32a90281e682c52b1
Author: Nishanth Menon <nm@ti.com>
Date:   Wed Apr 27 06:13:05 2011 -0700

    OMAP4: PM: remove redundant #ifdef CONFIG_PM

Note You need to log in before you can comment on or make changes to this bug.