On Wed, Jun 17, 2020 at 8:49 PM Russell King - ARM Linux admin
<[email protected]> wrote:
> On Wed, Jun 17, 2020 at 10:45:34PM +0530, Calvin Johnson wrote:
...
> > - ret = of_address_to_resource(np, 0, &res);
> > - if (ret) {
> > + res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
> > + if (!res) {
> > dev_err(&pdev->dev, "could not obtain address\n");
> > - return ret;
> > + return -EINVAL;
> > }
>
> I think, as you're completely rewriting the resource handling, it would
> be a good idea to switch over to using devm_* stuff here.
>
> void __iomem *regs;
>
> regs = devm_platform_ioremap_resource(pdev, 0);
> if (IS_ERR(regs))
{
> dev_err(&pdev->dev, "could not map resource: %pe\n",
> regs);
And just in case, this message is dup. The API has few of them
depending on the error conditions.
> return PTR_ERR(regs);
> }
--
With Best Regards,
Andy Shevchenko