Skip to contentSkip to conversation

clk: max77686: Fix return value checking for devm_kzalloc

PATCH New Axel Lin 2 participants 2 messages Dec 18, 2012 – Jan 12, 2013

Subsystems (2)
lore
Share & tools
lore

Axel Lin

author
#0 lore raw

PATCH 1/1 clk: max77686: Fix return value checking for devm_kzalloc

devm_kzalloc returns NULL on failure.

---
 drivers/clk/clk-max77686.c |    6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)
drivers/clk/clk-max77686.c +3 -3
index d098f72..8944214 100644
@@ -132,7 +132,7 @@ static int max77686_clk_register(struct device *dev,
 
 	max77686->lookup = devm_kzalloc(dev, sizeof(struct clk_lookup),
 					GFP_KERNEL);
-	if (IS_ERR(max77686->lookup))
+	if (!max77686->lookup)
 		return -ENOMEM;
 
 	max77686->lookup->con_id = hw->init->name;
@@ -151,13 +151,13 @@ static int max77686_clk_probe(struct platform_device *pdev)
 
 	max77686_clks = devm_kzalloc(&pdev->dev, sizeof(struct max77686_clk *)
 					* MAX77686_CLKS_NUM, GFP_KERNEL);
-	if (IS_ERR(max77686_clks))
+	if (!max77686_clks)
 		return -ENOMEM;
 
 	for (i = 0; i < MAX77686_CLKS_NUM; i++) {
 		max77686_clks[i] = devm_kzalloc(&pdev->dev,
 					sizeof(struct max77686_clk), GFP_KERNEL);
-		if (IS_ERR(max77686_clks[i]))
+		if (!max77686_clks[i])
 			return -ENOMEM;
 	}
 
Signature · 1 line
1.7.9.5
#1 lore raw

PATCH 1/1 clk: max77686: Fix return value checking for devm_kzalloc

Quoting Axel Lin (2012-12-17 23:43:45)

Quoted 3 lines

devm_kzalloc returns NULL on failure.

Pulled into clk-next.

Thanks for the patch,
Mike

Quoted 35 lines
---
 drivers/clk/clk-max77686.c |    6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)
drivers/clk/clk-max77686.c +3 -3
index d098f72..8944214 100644
@@ -132,7 +132,7 @@ static int max77686_clk_register(struct device *dev,
 
        max77686->lookup = devm_kzalloc(dev, sizeof(struct clk_lookup),
                                        GFP_KERNEL);
-       if (IS_ERR(max77686->lookup))
+       if (!max77686->lookup)
                return -ENOMEM;
 
        max77686->lookup->con_id = hw->init->name;
@@ -151,13 +151,13 @@ static int max77686_clk_probe(struct platform_device *pdev)
 
        max77686_clks = devm_kzalloc(&pdev->dev, sizeof(struct max77686_clk *)
                                        * MAX77686_CLKS_NUM, GFP_KERNEL);
-       if (IS_ERR(max77686_clks))
+       if (!max77686_clks)
                return -ENOMEM;
 
        for (i = 0; i < MAX77686_CLKS_NUM; i++) {
                max77686_clks[i] = devm_kzalloc(&pdev->dev,
                                        sizeof(struct max77686_clk), GFP_KERNEL);
-               if (IS_ERR(max77686_clks[i]))
+               if (!max77686_clks[i])
                        return -ENOMEM;
        }
 
Signature · 1 line
1.7.9.5