lkml.org 
[lkml]   [2015]   [Nov]   [19]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
From
Subject[PATCH 1/1] usb: phy: omap-otg: do not write to unallocated memory
Date
The current coding writes to memory before allocating it.

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
---
drivers/usb/phy/phy-omap-otg.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/drivers/usb/phy/phy-omap-otg.c b/drivers/usb/phy/phy-omap-otg.c
index 1270906..8bbf121 100644
--- a/drivers/usb/phy/phy-omap-otg.c
+++ b/drivers/usb/phy/phy-omap-otg.c
@@ -105,12 +105,13 @@ static int omap_otg_probe(struct platform_device *pdev)
extcon = extcon_get_extcon_dev(config->extcon);
if (!extcon)
return -EPROBE_DEFER;
- otg_dev->extcon = extcon;

otg_dev = devm_kzalloc(&pdev->dev, sizeof(*otg_dev), GFP_KERNEL);
if (!otg_dev)
return -ENOMEM;

+ otg_dev->extcon = extcon;
+
otg_dev->base = devm_ioremap_resource(&pdev->dev, &pdev->resource[0]);
if (IS_ERR(otg_dev->base))
return PTR_ERR(otg_dev->base);
--
2.1.4


\
 
 \ /
  Last update: 2015-11-20 01:01    [W:0.035 / U:0.212 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site