Skip to contentSkip to conversation

regulator: tps65218: Add NULL test for devm_kzalloc call

PATCH In review Axel Lin 4 participants 5 messages Nov 13, 2017 – Nov 17, 2017

Subsystems (2)
lore
Share & tools
lore

Axel Lin

author
#0 lore raw

PATCH 1/1 regulator: tps65218: Add NULL test for devm_kzalloc call

---
 drivers/regulator/tps65218-regulator.c | 2 ++
 1 file changed, 2 insertions(+)
drivers/regulator/tps65218-regulator.c +2 -0
index bc489958fed7..b3f89ebfb1a0 100644
@@ -329,6 +329,8 @@ static int tps65218_regulator_probe(struct platform_device *pdev)
 	/* Allocate memory for strobes */
 	tps->strobes = devm_kzalloc(&pdev->dev, sizeof(u8) *
 				    TPS65218_NUM_REGULATOR, GFP_KERNEL);
+	if (!tps->strobes)
+		return -ENOMEM;
 
 	for (i = 0; i < ARRAY_SIZE(regulators); i++) {
 		rdev = devm_regulator_register(&pdev->dev, &regulators[i],
Signature · 1 line
2.11.0
Reviewed-by on v1 1/1
#1 lore raw
Quoted 1 line · Axel Lin

One line commit message would be better than blank commit message. Otherwise:

Quoted 18 lines
---
 drivers/regulator/tps65218-regulator.c | 2 ++
 1 file changed, 2 insertions(+)
drivers/regulator/tps65218-regulator.c +2 -0
index bc489958fed7..b3f89ebfb1a0 100644
@@ -329,6 +329,8 @@ static int tps65218_regulator_probe(struct platform_device *pdev)
 	/* Allocate memory for strobes */
 	tps->strobes = devm_kzalloc(&pdev->dev, sizeof(u8) *
 				    TPS65218_NUM_REGULATOR, GFP_KERNEL);
+	if (!tps->strobes)
+		return -ENOMEM;
 
 	for (i = 0; i < ARRAY_SIZE(regulators); i++) {
 		rdev = devm_regulator_register(&pdev->dev, &regulators[i],
#3 lore raw
Quoted 9 lines · Axel Lin

2017-11-16 19:23 GMT+08:00 Keerthy <[email protected]>:

Quoted 6 lines · Axel Lin
Quoted 1 line

One line commit message would be better than blank commit message.

It's just too trivial and checkpatch does not complain.

I think trivial commits don't need commit messages if the subject line is sufficiently descriptive.

maintainer
#4 lore raw

Applied "regulator: tps65218: Add NULL test for devm_kzalloc call" to the regulator tree

In reply to Axel Lin

The patch

regulator: tps65218: Add NULL test for devm_kzalloc call

has been applied to the regulator tree at

https://git.kernel.org/pub/scm/linux/kernel/git/broonie/regulator.git

All being well this means that it will be integrated into the linux-next tree (usually sometime in the next 24 hours) and sent to Linus during the next merge window (or sooner if it is a bug fix), however if problems are discovered then the patch may be dropped or reverted.

You may get further e-mails resulting from automated or manual testing and review of the tree, please engage with people reporting problems and send followup patches addressing any issues that are reported if needed.

If any updates are required or you are submitting further changes they should be sent as incremental updates against current git, existing patches will not be replaced.

Please add any relevant lists and maintainers to the CCs when replying to this mail.

Thanks,
Mark

Quoted 1 line

From 5597bfb474d3ed84c1e0c73db620a257bbe127b6 Mon Sep 17 00:00:00 2001

From: Axel Lin <[email protected]>
Date: Mon, 13 Nov 2017 20:52:32 +0800
Subject: [PATCH] regulator: tps65218: Add NULL test for devm_kzalloc call

---
 drivers/regulator/tps65218-regulator.c | 2 ++
 1 file changed, 2 insertions(+)
drivers/regulator/tps65218-regulator.c +2 -0
index b6f705292aef..1827185beacc 100644
@@ -326,6 +326,8 @@ static int tps65218_regulator_probe(struct platform_device *pdev)
 	/* Allocate memory for strobes */
 	tps->strobes = devm_kzalloc(&pdev->dev, sizeof(u8) *
 				    TPS65218_NUM_REGULATOR, GFP_KERNEL);
+	if (!tps->strobes)
+		return -ENOMEM;
 
 	for (i = 0; i < ARRAY_SIZE(regulators); i++) {
 		rdev = devm_regulator_register(&pdev->dev, &regulators[i],
Signature · 1 line
2.14.1