Skip to contentSkip to conversation

regulator: bcm590xx: remove unnecessary OOM messages

PATCH Applied Jingoo Han 4 participants 11 messages Jun 2, 2014 – Jun 6, 2014

Subsystems (2)
lore
Share & tools
lore

Jingoo Han

author
#0 lore raw

PATCH 1/3 regulator: bcm590xx: remove unnecessary OOM messages

The site-specific OOM messages are unnecessary, because they duplicate the MM subsystem generic OOM message.

---
 drivers/regulator/bcm590xx-regulator.c |   16 ++++------------
 1 file changed, 4 insertions(+), 12 deletions(-)
drivers/regulator/bcm590xx-regulator.c +4 -12
index 57544e2..fb8c6f7 100644
@@ -326,10 +326,8 @@ static struct bcm590xx_board *bcm590xx_parse_dt_reg_data(
 	}
 
 	data = devm_kzalloc(&pdev->dev, sizeof(*data), GFP_KERNEL);
-	if (!data) {
-		dev_err(&pdev->dev, "failed to allocate regulator board data\n");
+	if (!data)
 		return NULL;
-	}
 
 	np = of_node_get(np);
 	regulators = of_get_child_by_name(np, "regulators");
@@ -374,10 +372,8 @@ static int bcm590xx_probe(struct platform_device *pdev)
 					      &bcm590xx_reg_matches);
 
 	pmu = devm_kzalloc(&pdev->dev, sizeof(*pmu), GFP_KERNEL);
-	if (!pmu) {
-		dev_err(&pdev->dev, "Memory allocation failed for pmu\n");
+	if (!pmu)
 		return -ENOMEM;
-	}
 
 	pmu->mfd = bcm590xx;
 
@@ -385,17 +381,13 @@ static int bcm590xx_probe(struct platform_device *pdev)
 
 	pmu->desc = devm_kzalloc(&pdev->dev, BCM590XX_NUM_REGS *
 			sizeof(struct regulator_desc), GFP_KERNEL);
-	if (!pmu->desc) {
-		dev_err(&pdev->dev, "Memory alloc fails for desc\n");
+	if (!pmu->desc)
 		return -ENOMEM;
-	}
 
 	pmu->info = devm_kzalloc(&pdev->dev, BCM590XX_NUM_REGS *
 			sizeof(struct bcm590xx_info *), GFP_KERNEL);
-	if (!pmu->info) {
-		dev_err(&pdev->dev, "Memory alloc fails for info\n");
+	if (!pmu->info)
 		return -ENOMEM;
-	}
 
 	info = bcm590xx_regs;
 
Signature · 1 line
1.7.10.4
author
#1 lore raw

PATCH 2/3 regulator: max8649: remove unnecessary OOM messages

The site-specific OOM messages are unnecessary, because they duplicate the MM subsystem generic OOM message.

---
 drivers/regulator/max8649.c |    4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)
drivers/regulator/max8649.c +1 -3
index 3172da8..c8bddcc 100644
@@ -161,10 +161,8 @@ static int max8649_regulator_probe(struct i2c_client *client,
 
 	info = devm_kzalloc(&client->dev, sizeof(struct max8649_regulator_info),
 			    GFP_KERNEL);
-	if (!info) {
-		dev_err(&client->dev, "No enough memory\n");
+	if (!info)
 		return -ENOMEM;
-	}
 
 	info->regmap = devm_regmap_init_i2c(client, &max8649_regmap_config);
 	if (IS_ERR(info->regmap)) {
Signature · 1 line
1.7.10.4
maintainer Applied
#2 lore raw

Re: [PATCH 2/3] regulator: max8649: remove unnecessary OOM messages

Quoted 2 lines · Jingoo Han

The site-specific OOM messages are unnecessary, because they duplicate the MM subsystem generic OOM message.

Applied, thanks.

author
#3 lore raw

PATCH 3/3 regulator: pbias: remove unnecessary OOM messages

In reply to Jingoo Han

The site-specific OOM messages are unnecessary, because they duplicate the MM subsystem generic OOM message.

---
 drivers/regulator/pbias-regulator.c |    4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)
drivers/regulator/pbias-regulator.c +1 -3
index 708ddbb..6d02d68 100644
@@ -122,10 +122,8 @@ static int pbias_regulator_probe(struct platform_device *pdev)
 
 	drvdata = devm_kzalloc(&pdev->dev, sizeof(struct pbias_regulator_data)
 			       * count, GFP_KERNEL);
-	if (drvdata == NULL) {
-		dev_err(&pdev->dev, "Failed to allocate device data\n");
+	if (!drvdata)
 		return -ENOMEM;
-	}
 
 	syscon = syscon_regmap_lookup_by_phandle(np, "syscon");
 	if (IS_ERR(syscon))
Signature · 1 line
1.7.10.4
maintainer Applied
#4 lore raw

Re: [PATCH 3/3] regulator: pbias: remove unnecessary OOM messages

Quoted 2 lines · Jingoo Han

The site-specific OOM messages are unnecessary, because they duplicate the MM subsystem generic OOM message.

Applied, thanks.

#5 lore raw
In reply to Jingoo Han
Quoted 46 lines · Jingoo Han

The site-specific OOM messages are unnecessary, because they duplicate the MM subsystem generic OOM message.

---
 drivers/regulator/bcm590xx-regulator.c |   16 ++++------------
 1 file changed, 4 insertions(+), 12 deletions(-)
drivers/regulator/bcm590xx-regulator.c +3 -9
index 57544e2..fb8c6f7 100644
@@ -326,10 +326,8 @@ static struct bcm590xx_board *bcm590xx_parse_dt_reg_data(
        }
 
        data = devm_kzalloc(&pdev->dev, sizeof(*data), GFP_KERNEL);
-       if (!data) {
-               dev_err(&pdev->dev, "failed to allocate regulator board data\n");
+       if (!data)
                return NULL;
-       }
 
        np = of_node_get(np);
        regulators = of_get_child_by_name(np, "regulators");
@@ -374,10 +372,8 @@ static int bcm590xx_probe(struct platform_device *pdev)
                                              &bcm590xx_reg_matches);
 
        pmu = devm_kzalloc(&pdev->dev, sizeof(*pmu), GFP_KERNEL);
-       if (!pmu) {
-               dev_err(&pdev->dev, "Memory allocation failed for pmu\n");
+       if (!pmu)
                return -ENOMEM;
-       }
 
        pmu->mfd = bcm590xx;
 
@@ -385,17 +381,13 @@ static int bcm590xx_probe(struct platform_device *pdev)
 
        pmu->desc = devm_kzalloc(&pdev->dev, BCM590XX_NUM_REGS *
                        sizeof(struct regulator_desc), GFP_KERNEL);
-       if (!pmu->desc) {
-               dev_err(&pdev->dev, "Memory alloc fails for desc\n");
+       if (!pmu->desc)
                return -ENOMEM;
-       }
 

drivers/regulator/bcm590xx-regulator.c static int bcm590xx_probe(struct platform_device *pdev) · line 393

Quoted 10 lines
drivers/regulator/bcm590xx-regulator.c +1 -3
        pmu->info = devm_kzalloc(&pdev->dev, BCM590XX_NUM_REGS *
                        sizeof(struct bcm590xx_info *), GFP_KERNEL);
-       if (!pmu->info) {
-               dev_err(&pdev->dev, "Memory alloc fails for info\n");
+       if (!pmu->info)
                return -ENOMEM;
-       }
 
        info = bcm590xx_regs;
 

For the other two drivers touched by this patch series, the probe methods only include a single dynamic memory allocation. As such, the stack trace provided by the generic memory code is sufficient to quickly identify where the failure occurred.

The probe method of this driver, on the other hand, performs several allocations and the error messages you intend to remove conveniently pinpoint which one failed. While the offsets in the trace could be used to derive the same information, I am skeptical that is enough to justify removing the messages.

Thanks,
Tim Kryger

maintainer
#6 lore raw
Quoted 5 lines · Tim Kryger

The probe method of this driver, on the other hand, performs several allocations and the error messages you intend to remove conveniently pinpoint which one failed. While the offsets in the trace could be used to derive the same information, I am skeptical that is enough to justify removing the messages.

On the other hand how likely is anyone to care which particular allocation triggered the OOM?

#7 lore raw
Quoted 10 lines · Mark Brown
Quoted 5 lines · Tim Kryger

The probe method of this driver, on the other hand, performs several allocations and the error messages you intend to remove conveniently pinpoint which one failed. While the offsets in the trace could be used to derive the same information, I am skeptical that is enough to justify removing the messages.

On the other hand how likely is anyone to care which particular allocation triggered the OOM?

I suppose you would only care if a failure was due to something unique about a specific allocation. For example, if someone made a foolish change to a structure that resulted in a request for substantially more memory, the messages would lead directly to the problem.

The real question is whether this change improves the driver. To me, it seems like a draw.

maintainer
#8 lore raw
Quoted 2 lines · Tim Kryger

The real question is whether this change improves the driver. To me, it seems like a draw.

It's not really for the benefit of the driver, it's for the benefit of the kernel as a whole - the individually hand crafted error messages all take up space in the kernel so if we just remove them and rely on the OOM messages being loud we will in aggregate save some not completely trivial amount of space in the kernel image. Not a *massive* amount but somewhat helpful.

Acked-by on v1 1/3
#9 lore raw
In reply to Jingoo Han
Quoted 7 lines · Jingoo Han

The site-specific OOM messages are unnecessary, because they duplicate the MM subsystem generic OOM message.

---
 drivers/regulator/bcm590xx-regulator.c |   16 ++++------------
 1 file changed, 4 insertions(+), 12 deletions(-)

Looks good, thanks.

Quoted 52 lines
drivers/regulator/bcm590xx-regulator.c +4 -12
index 57544e2..fb8c6f7 100644
@@ -326,10 +326,8 @@ static struct bcm590xx_board *bcm590xx_parse_dt_reg_data(
 	}
 
 	data = devm_kzalloc(&pdev->dev, sizeof(*data), GFP_KERNEL);
-	if (!data) {
-		dev_err(&pdev->dev, "failed to allocate regulator board data\n");
+	if (!data)
 		return NULL;
-	}
 
 	np = of_node_get(np);
 	regulators = of_get_child_by_name(np, "regulators");
@@ -374,10 +372,8 @@ static int bcm590xx_probe(struct platform_device *pdev)
 					      &bcm590xx_reg_matches);
 
 	pmu = devm_kzalloc(&pdev->dev, sizeof(*pmu), GFP_KERNEL);
-	if (!pmu) {
-		dev_err(&pdev->dev, "Memory allocation failed for pmu\n");
+	if (!pmu)
 		return -ENOMEM;
-	}
 
 	pmu->mfd = bcm590xx;
 
@@ -385,17 +381,13 @@ static int bcm590xx_probe(struct platform_device *pdev)
 
 	pmu->desc = devm_kzalloc(&pdev->dev, BCM590XX_NUM_REGS *
 			sizeof(struct regulator_desc), GFP_KERNEL);
-	if (!pmu->desc) {
-		dev_err(&pdev->dev, "Memory alloc fails for desc\n");
+	if (!pmu->desc)
 		return -ENOMEM;
-	}
 
 	pmu->info = devm_kzalloc(&pdev->dev, BCM590XX_NUM_REGS *
 			sizeof(struct bcm590xx_info *), GFP_KERNEL);
-	if (!pmu->info) {
-		dev_err(&pdev->dev, "Memory alloc fails for info\n");
+	if (!pmu->info)
 		return -ENOMEM;
-	}
 
 	info = bcm590xx_regs;
 
Signature · 1 line
1.7.10.4
maintainer Applied
#10 lore raw
In reply to Jingoo Han
Quoted 2 lines · Jingoo Han

The site-specific OOM messages are unnecessary, because they duplicate the MM subsystem generic OOM message.

Applied, thanks.