[<prev] [next>] [day] [month] [year] [list]
Message-ID: <20120425084702.GB12799@elgon.mountain>
Date: Wed, 25 Apr 2012 11:47:02 +0300
From: Dan Carpenter <dan.carpenter@...cle.com>
To: MyungJoo Ham <myungjoo.ham@...sung.com>
Cc: Greg Kroah-Hartman <gregkh@...uxfoundation.org>,
Kyungmin Park <kyungmin.park@...sung.com>,
Mark Brown <broonie@...nsource.wolfsonmicro.com>,
Donggeun Kim <dg77.kim@...sung.com>,
linux-kernel@...r.kernel.org, kernel-janitors@...r.kernel.org
Subject: [patch] Extcon: check for allocation failure
Return -ENOMEM if the kmalloc() fails.
Signed-off-by: Dan Carpenter <dan.carpenter@...cle.com>
diff --git a/drivers/extcon/extcon_class.c b/drivers/extcon/extcon_class.c
index 3bc4b8a..fe5a038 100644
--- a/drivers/extcon/extcon_class.c
+++ b/drivers/extcon/extcon_class.c
@@ -621,6 +621,8 @@ int extcon_dev_register(struct extcon_dev *edev, struct device *dev)
}
edev->dev = kzalloc(sizeof(struct device), GFP_KERNEL);
+ if (!edev->dev)
+ return -ENOMEM;
edev->dev->parent = dev;
edev->dev->class = extcon_class;
edev->dev->release = extcon_dev_release;
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists