mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH] regulator: s2mps11: Don't zero allocated memory for external control
@ 2014-10-16  8:23 Krzysztof Kozlowski
  2014-10-16  8:49 ` Mark Brown
  0 siblings, 1 reply; 2+ messages in thread
From: Krzysztof Kozlowski @ 2014-10-16  8:23 UTC (permalink / raw)
  To: Sangbeom Kim, Liam Girdwood, Mark Brown, linux-kernel; +Cc: Krzysztof Kozlowski

The driver was allocating memory for storing GPIOs for external control
with unnecessary GFP_ZERO flag. Then right after allocation it
initialized memory to -EINVAL in loop. Skip the GFP_ZERO flag.

Signed-off-by: Krzysztof Kozlowski <k.kozlowski@samsung.com>
---
 drivers/regulator/s2mps11.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/regulator/s2mps11.c b/drivers/regulator/s2mps11.c
index adab82d5279f..7f59e67252e7 100644
--- a/drivers/regulator/s2mps11.c
+++ b/drivers/regulator/s2mps11.c
@@ -845,7 +845,7 @@ static int s2mps11_pmic_probe(struct platform_device *pdev)
 		return -EINVAL;
 	};
 
-	s2mps11->ext_control_gpio = devm_kzalloc(&pdev->dev,
+	s2mps11->ext_control_gpio = devm_kmalloc(&pdev->dev,
 			sizeof(*s2mps11->ext_control_gpio) * s2mps11->rdev_num,
 			GFP_KERNEL);
 	if (!s2mps11->ext_control_gpio)
-- 
1.9.1


^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [PATCH] regulator: s2mps11: Don't zero allocated memory for external control
  2014-10-16  8:23 [PATCH] regulator: s2mps11: Don't zero allocated memory for external control Krzysztof Kozlowski
@ 2014-10-16  8:49 ` Mark Brown
  0 siblings, 0 replies; 2+ messages in thread
From: Mark Brown @ 2014-10-16  8:49 UTC (permalink / raw)
  To: Krzysztof Kozlowski; +Cc: Sangbeom Kim, Liam Girdwood, linux-kernel

[-- Attachment #1: Type: text/plain, Size: 378 bytes --]

On Thu, Oct 16, 2014 at 10:23:28AM +0200, Krzysztof Kozlowski wrote:
> The driver was allocating memory for storing GPIOs for external control
> with unnecessary GFP_ZERO flag. Then right after allocation it
> initialized memory to -EINVAL in loop. Skip the GFP_ZERO flag.

Applied, though it's a bit of a microptimisation and it would be better
to use kmalloc_array() instead.

[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 473 bytes --]

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2014-10-16  8:51 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-10-16  8:23 [PATCH] regulator: s2mps11: Don't zero allocated memory for external control Krzysztof Kozlowski
2014-10-16  8:49 ` Mark Brown

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®