diff mbox

pwm: omap-dmtimer: Potential NULL dereference on error

Message ID 20151221131304.GA27286@mwanda
State Accepted
Headers show

Commit Message

Dan Carpenter Dec. 21, 2015, 1:13 p.m. UTC
"omap" is NULL so we can't dereference it.

Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
---
It's weird that request_by_node() and free() are allocate/free pairs.
Also this was Thierry's last minute tweaks mentioned in the changelog,
Neil Armstrong is innocent.  :P

--
To unsubscribe from this list: send the line "unsubscribe linux-pwm" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Comments

Thierry Reding Jan. 4, 2016, 8 a.m. UTC | #1
On Mon, Dec 21, 2015 at 04:13:04PM +0300, Dan Carpenter wrote:
> "omap" is NULL so we can't dereference it.
> 
> Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
> ---
> It's weird that request_by_node() and free() are allocate/free pairs.
> Also this was Thierry's last minute tweaks mentioned in the changelog,
> Neil Armstrong is innocent.  :P

Applie, thanks.

Thierry
diff mbox

Patch

diff --git a/drivers/pwm/pwm-omap-dmtimer.c b/drivers/pwm/pwm-omap-dmtimer.c
index c453b33..826634e 100644
--- a/drivers/pwm/pwm-omap-dmtimer.c
+++ b/drivers/pwm/pwm-omap-dmtimer.c
@@ -243,7 +243,7 @@  static int pwm_omap_dmtimer_probe(struct platform_device *pdev)
 
 	omap = devm_kzalloc(&pdev->dev, sizeof(*omap), GFP_KERNEL);
 	if (!omap) {
-		omap->pdata->free(dm_timer);
+		pdata->free(dm_timer);
 		return -ENOMEM;
 	}