Re: [PATCH 1/2] clk: socfpga: stratix10: use platform driver APIs

From: Stephen Boyd
Date: Tue May 15 2018 - 17:53:20 EST


Quoting Dinh Nguyen (2018-05-02 07:28:32)
> + struct resource *res;
> void __iomem *base;
>
> - base = of_iomap(np, 0);
> - if (!base) {
> + res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
> + base = devm_ioremap_resource(dev, res);
> + if (IS_ERR(base)) {
> pr_err("%s: failed to map clock registers\n", __func__);
> - goto err;
> + return ERR_CAST(base);
> }
>
> - clk_data = kzalloc(sizeof(*clk_data), GFP_KERNEL);
> + clk_data = devm_kzalloc(dev, sizeof(*clk_data), GFP_KERNEL);
> if (!clk_data)
> - goto err;
> + return ERR_CAST(clk_data);

I had to make these ERR_PTR(-ENOMEM), but otherwise I applied this to
clk-next.