public inbox for kernel-janitors@vger.kernel.org
 help / color / mirror / Atom feed
* [patch] Extcon: check for allocation failure
@ 2012-04-25  8:47 Dan Carpenter
  2012-04-25  8:53 ` MyungJoo Ham
  0 siblings, 1 reply; 2+ messages in thread
From: Dan Carpenter @ 2012-04-25  8:47 UTC (permalink / raw)
  To: MyungJoo Ham
  Cc: Greg Kroah-Hartman, Kyungmin Park, Mark Brown, Donggeun Kim,
	linux-kernel, kernel-janitors

Return -ENOMEM if the kmalloc() fails.

Signed-off-by: Dan Carpenter <dan.carpenter@oracle.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;

^ permalink raw reply related	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2012-04-25  8:53 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-04-25  8:47 [patch] Extcon: check for allocation failure Dan Carpenter
2012-04-25  8:53 ` MyungJoo Ham

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox