All of lore.kernel.org
 help / color / mirror / Atom feed
From: Ley Foon Tan <ley.foon.tan@intel.com>
To: u-boot@lists.denx.de
Subject: [U-Boot] [PATCH] gpio: dwapb_gpio: Change to use devm_kcalloc()
Date: Thu,  6 Sep 2018 22:48:39 +0800	[thread overview]
Message-ID: <1536245319-3135-1-git-send-email-ley.foon.tan@intel.com> (raw)

Change to use managed resource function devm_kcalloc(),
so it will auto free memory when driver is removed.

Signed-off-by: Ley Foon Tan <ley.foon.tan@intel.com>
---
 drivers/gpio/dwapb_gpio.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/drivers/gpio/dwapb_gpio.c b/drivers/gpio/dwapb_gpio.c
index 0f6574d..1594434 100644
--- a/drivers/gpio/dwapb_gpio.c
+++ b/drivers/gpio/dwapb_gpio.c
@@ -171,8 +171,7 @@ static int gpio_dwapb_bind(struct udevice *dev)
 		if (!fdtdec_get_bool(blob, node, "gpio-controller"))
 			continue;
 
-		plat = NULL;
-		plat = calloc(1, sizeof(*plat));
+		plat = devm_kcalloc(dev, 1, sizeof(*plat), GFP_KERNEL);
 		if (!plat)
 			return -ENOMEM;
 
-- 
2.2.2

             reply	other threads:[~2018-09-06 14:48 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-09-06 14:48 Ley Foon Tan [this message]
2018-09-06 10:05 ` [U-Boot] [PATCH] gpio: dwapb_gpio: Change to use devm_kcalloc() Marek Vasut
2018-09-07  0:57   ` Ley Foon Tan

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1536245319-3135-1-git-send-email-ley.foon.tan@intel.com \
    --to=ley.foon.tan@intel.com \
    --cc=u-boot@lists.denx.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.