[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-Id: <20171113125232.9672-1-axel.lin@ingics.com>
Date: Mon, 13 Nov 2017 20:52:32 +0800
From: Axel Lin <axel.lin@...ics.com>
To: Mark Brown <broonie@...nel.org>
Cc: Keerthy <j-keerthy@...com>, Liam Girdwood <lgirdwood@...il.com>,
linux-kernel@...r.kernel.org, Axel Lin <axel.lin@...ics.com>
Subject: [PATCH] regulator: tps65218: Add NULL test for devm_kzalloc call
Signed-off-by: Axel Lin <axel.lin@...ics.com>
---
drivers/regulator/tps65218-regulator.c | 2 ++
1 file changed, 2 insertions(+)
diff --git a/drivers/regulator/tps65218-regulator.c b/drivers/regulator/tps65218-regulator.c
index bc489958fed7..b3f89ebfb1a0 100644
--- a/drivers/regulator/tps65218-regulator.c
+++ b/drivers/regulator/tps65218-regulator.c
@@ -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, ®ulators[i],
--
2.11.0
Powered by blists - more mailing lists