Skip to contentSkip to conversation

drivers: soc: add support for exynos SROM driver

PATCH LABBE Corentin 2 participants 2 messages Oct 13, 2015 – Oct 19, 2015 Arm Samsung Exynos

lore
Share & tools
lore
#0 lore 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

#1 lore raw

Hi,

Thanks for review.

Quoted 17 lines · LABBE Corentin
(quoted diff) +16 -0
+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;
+}
Quoted 2 lines

You do not free rd anywhere in your code.

OK, I missed that, corrected in v4.

Quoted 10 lines
(quoted diff) +6 -0
+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) {}

Taken care in v4.

Quoted 9 lines
(quoted diff) +6 -0
+       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

Taken care in v4.

Quoted 12 lines
(quoted diff) +11 -0
+
+       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;
+}
Quoted 2 lines

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

OK. Taken care in v4.

Posted v4 here

https://lkml.org/lkml/2015/10/19/278

Thanks,
Pankaj Dubey

Quoted 7 lines

Regards
LABBE Corentin

--
To unsubscribe from this list: send the line "unsubscribe linux-samsung-soc" in the body of a message to majordomo at vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html