Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 8353584e authored by Stefan Weil's avatar Stefan Weil Committed by Kevin Hilman
Browse files

OMAP: PM: SmartReflex: Fix possible null pointer read access



These errors were found by cppcheck:
arch/arm/mach-omap2/smartreflex.c:784: error: Possible null pointer dereference: sr_info
arch/arm/mach-omap2/smartreflex.c:799: error: Possible null pointer dereference: sr_info

Both conditional statements are executed when sr_info == NULL,
so accessing sr_info->voltdm would fail.

Cc: Russell King <linux@arm.linux.org.uk>
Cc: linux-omap@vger.kernel.org
Cc: linux-arm-kernel@lists.infradead.org
Cc: linux-kernel@vger.kernel.org
Signed-off-by: default avatarStefan Weil <weil@mail.berlios.de>
Signed-off-by: default avatarKevin Hilman <khilman@ti.com>
parent 720bc782
Loading
Loading
Loading
Loading
+2 −4
Original line number Diff line number Diff line
@@ -780,8 +780,7 @@ static int omap_sr_autocomp_show(void *data, u64 *val)
	struct omap_sr *sr_info = (struct omap_sr *) data;

	if (!sr_info) {
		pr_warning("%s: omap_sr struct for sr_%s not found\n",
			__func__, sr_info->voltdm->name);
		pr_warning("%s: omap_sr struct not found\n", __func__);
		return -EINVAL;
	}

@@ -795,8 +794,7 @@ static int omap_sr_autocomp_store(void *data, u64 val)
	struct omap_sr *sr_info = (struct omap_sr *) data;

	if (!sr_info) {
		pr_warning("%s: omap_sr struct for sr_%s not found\n",
			__func__, sr_info->voltdm->name);
		pr_warning("%s: omap_sr struct not found\n", __func__);
		return -EINVAL;
	}