diff mbox

omap:dmtimer:no null check for kzalloc

Message ID 1278886185-12502-1-git-send-email-tarun.kanti@ti.com (mailing list archive)
State New, archived
Headers show

Commit Message

Tarun Kanti DebBarma July 11, 2010, 10:09 p.m. UTC
None
diff mbox

Patch

diff --git a/arch/arm/mach-omap2/dmtimers.c b/arch/arm/mach-omap2/dmtimers.c
index 772be63..a7e9ac5 100644
--- a/arch/arm/mach-omap2/dmtimers.c
+++ b/arch/arm/mach-omap2/dmtimers.c
@@ -248,7 +248,12 @@  void __init omap2_dm_timer_early_init(void)
 
 			pdata = kzalloc(sizeof(struct omap_dm_timer_plat_info),
 					GFP_KERNEL);
-
+			if (!pdata) {
+				pr_err("%s: \
+				No memory for omap_dm_timer_plat_info\n",
+				__func__);
+				return -ENOMEM;
+			}
 			pdata->omap_dm_clk_enable = omap2_dm_timer_enable;
 			pdata->omap_dm_clk_disable = omap2_dm_timer_disable;
 			pdata->omap_dm_set_source_clk = omap2_dm_timer_set_clk;
@@ -346,6 +351,12 @@  int __init omap2_dm_timer_init(void)
 
 			pdata = kzalloc(sizeof(struct omap_dm_timer_plat_info),
 					GFP_KERNEL);
+			if (!pdata) {
+				pr_err("%s: \
+				No memory for omap_dm_timer_plat_info\n",
+				__func__);
+				return -ENOMEM;
+			}
 			pdata->omap_dm_clk_enable = omap2_dm_timer_enable;
 			pdata->omap_dm_clk_disable = omap2_dm_timer_disable;
 			pdata->omap_dm_set_source_clk = omap2_dm_timer_set_clk;
@@ -397,7 +408,12 @@  fail:
 				break;
 			pdata = kzalloc(sizeof(struct omap_dm_timer_plat_info),
 					GFP_KERNEL);
-
+			if (!pdata) {
+				pr_err("%s: \
+				No memory for omap_dm_timer_plat_info\n",
+				__func__);
+				return -ENOMEM;
+			}
 			pdata->omap_dm_clk_enable = omap2_dm_timer_enable;
 			pdata->omap_dm_clk_disable = omap2_dm_timer_disable;
 			pdata->omap_dm_set_source_clk = omap2_dm_timer_set_clk;