Re: [PATCH v3 2/3] Input: add new vibrator driver for various MSM SOCs

From: Brian Masney
Date: Tue Feb 05 2019 - 19:52:19 EST


On Tue, Feb 05, 2019 at 11:42:46AM -0800, Dmitry Torokhov wrote:
> > + dev_err(&pdev->dev, "Failed to lookup pwm clock: %ld\n",
> > + PTR_ERR(vibrator->clk));
> > + return PTR_ERR(vibrator->clk);
> > + }
> > +
> > + res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
> > + if (!res) {
> > + dev_err(&pdev->dev, "Failed to get platform resource\n");
> > + return -ENODEV;
> > + }
> > +
> > + vibrator->base = devm_ioremap(&pdev->dev, res->start,
> > + resource_size(res));
> > + if (IS_ERR(vibrator->base)) {
>
> devm_ioremap() returns NULL on error. You either need to check for NULL
> or see of you can use devm_ioremap_resource().

I originally tried to use devm_ioremap_resource() but the call to
devm_request_mem_region() would fail. I'll go with the NULL check here
for devm_ioremap().

Thanks for the review!

Brian