public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: LABBE Corentin <clabbe.montjoie@gmail.com>
To: pankaj.dubey@samsung.com
Cc: linux-samsung-soc@vger.kernel.org, linux-kernel@vger.kernel.org,
	linux-arm-kernel@lists.infradead.org, kgene.kim@samsung.com,
	k.kozlowski@samsung.com, p.fedin@samsung.com,
	thomas.ab@samsung.com
Subject: Re: [PATCH v3 6/8] drivers: soc: add support for exynos SROM driver
Date: Tue, 13 Oct 2015 17:00:02 +0200	[thread overview]
Message-ID: <20151013150002.GA27569@Red> (raw)

+static struct exynos_srom_reg_dump *exynos_srom_alloc_reg_dump(
+               const unsigned long *rdump,
+               unsigned long nr_rdump)
+{
+       struct exynos_srom_reg_dump *rd;
+       unsigned int i;
+ 
+       rd = kcalloc(nr_rdump, sizeof(*rd), GFP_KERNEL);
+       if (!rd)
+               return NULL;
+
+       for (i = 0; i < nr_rdump; ++i)
+               rd[i].offset = rdump[i];
+
+       return rd;
+}

You do not free rd anywhere in your code.

+static int exynos_srom_probe(struct platform_device *pdev)
+{
+       struct device_node *np;
+       struct device *dev = &pdev->dev;
+
+       np = dev->of_node;

Are you sure that dev->of_node will be always set ?
I see lots of driver who if (dev->of_node) {}

+       exynos_srom_base = of_iomap(np, 0);
+
+       if (!exynos_srom_base) {
+               pr_err("iomap of exynos srom controller failed\n");
+               return -ENOMEM;
+       }

You can use dev_err(dev, "") insted of pr_err

+
+       exynos_srom_regs = exynos_srom_alloc_reg_dump(exynos_srom_offsets,
+                       sizeof(exynos_srom_offsets));
+
+       if (!exynos_srom_regs) {
+               iounmap(exynos_srom_regs);
+               return -ENOMEM;
+       }
+
+       return 0;
+}

Instead of using a global static exynos_srom_base/exynos_srom_regs, why you do not use platform_set_drvdata() ?

Regards
LABBE Corentin


             reply	other threads:[~2015-10-13 15:00 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-10-13 15:00 LABBE Corentin [this message]
2015-10-19 14:28 ` [PATCH v3 6/8] drivers: soc: add support for exynos SROM driver Pankaj Dubey
  -- strict thread matches above, loose matches on Subject: below --
2015-10-13 13:13 [PATCH v3 0/8] Add support for Exynos SROM Controller driver Pankaj Dubey
2015-10-13 13:13 ` [PATCH v3 6/8] drivers: soc: add support for exynos SROM driver Pankaj Dubey

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=20151013150002.GA27569@Red \
    --to=clabbe.montjoie@gmail.com \
    --cc=k.kozlowski@samsung.com \
    --cc=kgene.kim@samsung.com \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-samsung-soc@vger.kernel.org \
    --cc=p.fedin@samsung.com \
    --cc=pankaj.dubey@samsung.com \
    --cc=thomas.ab@samsung.com \
    /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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox