lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CAHQ1cqFgS1euUwc=vuUX1W24fBPcvb3tUsTwwFTKUb9tEdWNzg@mail.gmail.com>
Date:   Fri, 5 Apr 2019 11:14:15 -0700
From:   Andrey Smirnov <andrew.smirnov@...il.com>
To:     Daniel Lezcano <daniel.lezcano@...aro.org>
Cc:     linux-pm@...r.kernel.org, Chris Healy <cphealy@...il.com>,
        Lucas Stach <l.stach@...gutronix.de>,
        Zhang Rui <rui.zhang@...el.com>,
        Eduardo Valentin <edubezval@...il.com>,
        Angus Ainslie <angus@...ea.ca>,
        dl-linux-imx <linux-imx@....com>,
        linux-kernel <linux-kernel@...r.kernel.org>
Subject: Re: [PATCH v3 08/13] thermal: qoriq: Convert driver to use devm_ioremap()

On Thu, Apr 4, 2019 at 1:23 AM Daniel Lezcano <daniel.lezcano@...aro.org> wrote:
>
> On 01/04/2019 06:14, Andrey Smirnov wrote:
> > Convert driver to use devm_ioremap() to simplify memory deallocation
> > and error handling code. No functional change intended.
> >
> > Signed-off-by: Andrey Smirnov <andrew.smirnov@...il.com>
> > Cc: Chris Healy <cphealy@...il.com>
> > Cc: Lucas Stach <l.stach@...gutronix.de>
> > Cc: Zhang Rui <rui.zhang@...el.com>
> > Cc: Eduardo Valentin <edubezval@...il.com>
> > Cc: Daniel Lezcano <daniel.lezcano@...aro.org>
> > Cc: Angus Ainslie (Purism) <angus@...ea.ca>
> > Cc: linux-imx@....com
> > Cc: linux-pm@...r.kernel.org
> > Cc: linux-kernel@...r.kernel.org
> > ---
> >  drivers/thermal/qoriq_thermal.c | 20 ++++++++++----------
> >  1 file changed, 10 insertions(+), 10 deletions(-)
> >
> > diff --git a/drivers/thermal/qoriq_thermal.c b/drivers/thermal/qoriq_thermal.c
> > index a3ddb55740e4..4f9a2543f9c3 100644
> > --- a/drivers/thermal/qoriq_thermal.c
> > +++ b/drivers/thermal/qoriq_thermal.c
> > @@ -192,6 +192,7 @@ static int qoriq_tmu_probe(struct platform_device *pdev)
> >       struct qoriq_tmu_data *data;
> >       struct device_node *np = pdev->dev.of_node;
> >       struct device *dev = &pdev->dev;
> > +     struct resource *io;
> >
> >       data = devm_kzalloc(dev, sizeof(struct qoriq_tmu_data),
> >                           GFP_KERNEL);
> > @@ -200,7 +201,13 @@ static int qoriq_tmu_probe(struct platform_device *pdev)
> >
> >       data->little_endian = of_property_read_bool(np, "little-endian");
> >
> > -     data->regs = of_iomap(np, 0);
> > +     io = platform_get_resource(pdev, IORESOURCE_MEM, 0);
> > +     if (!io) {
> > +             dev_err(dev, "Failed to get memory region\n");
> > +             return -ENODEV;
> > +     }
> > +
> > +     data->regs = devm_ioremap(dev, io->start, resource_size(io));
>
>
>         res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
>         base = devm_ioremap_resource(&pdev->dev, res);
> ?
>

devm_ioremap_resource() will call devm_request_mem_region() which
would change original behavior. I don't know if original code was
purposefully written to not request underlying memory region or not,
but I didn't want to change the behavior. I am more than happy to
change the code to use devm_ioremap_resource() (or probably even
devm_platform_ioremap_resource()) if we agree that such a change is
acceptable.

Thanks,
Andrey Smirnov

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ