[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date: Tue, 8 Aug 2023 16:53:50 +0300
From: Andy Shevchenko <andriy.shevchenko@...ux.intel.com>
To: Jonathan Cameron <Jonathan.Cameron@...wei.com>
Cc: Wenhua Lin <Wenhua.Lin@...soc.com>,
Dmitry Torokhov <dmitry.torokhov@...il.com>,
Nuno Sá <nuno.sa@...log.com>,
Arnd Bergmann <arnd@...db.de>,
Samuel Holland <samuel@...lland.org>,
Robert Jarzmik <robert.jarzmik@...e.fr>,
Mattijs Korpershoek <mkorpershoek@...libre.com>,
Bartosz Golaszewski <bartosz.golaszewski@...aro.org>,
Orson Zhai <orsonzhai@...il.com>,
Baolin Wang <baolin.wang@...ux.alibaba.com>,
Chunyan Zhang <zhang.lyra@...il.com>,
linux-serial@...r.kernel.org, linux-kernel@...r.kernel.org,
wenhua lin <wenhua.lin1994@...il.com>,
Xiongpeng Wu <xiongpeng.wu@...soc.com>
Subject: Re: [PATCH] input: keyboard: Add sprd-keypad driver
On Tue, Aug 08, 2023 at 10:07:21AM +0100, Jonathan Cameron wrote:
> On Tue, 8 Aug 2023 15:25:01 +0800
> Wenhua Lin <Wenhua.Lin@...soc.com> wrote:
...
> > + res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
> > + data->base = devm_ioremap_resource(&pdev->dev, res);
>
> devm_platform_get_and_ioremap_resource)
Is res used anywhere else?
> > + if (IS_ERR(data->base)) {
> > + dev_err(&pdev->dev, "ioremap resource failed.\n");
> > + ret = PTR_ERR(data->base);
> > + goto err_free;
>
> Read up on what devm calls do - there is no need to manually free
> things that were allocated with them in the error paths or remove.
> So this should be a direct return. Also use
> return dev_err_probe(&pdev->dev, PTR_ERR(data->base),
> "....")
Btw, with
struct device *dev = &pdev->dev;
all these become neater.
> It both creates neater code and for cases where deferred probing
> is possible you will get a nice message on 'why' registered for
> debug purposes.
>
> > + }
--
With Best Regards,
Andy Shevchenko
Powered by blists - more mailing lists