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: <20190516211151.qwac53shdjhlwj4p@core.my.home>
Date:   Thu, 16 May 2019 23:11:51 +0200
From:   Ondřej Jirman <megous@...ous.com>
To:     Frank Lee <tiny.windzz@...il.com>
Cc:     Maxime Ripard <maxime.ripard@...tlin.com>,
        Mark Rutland <mark.rutland@....com>,
        Daniel Lezcano <daniel.lezcano@...aro.org>,
        catalin.marinas@....com, will.deacon@....com,
        bjorn.andersson@...aro.org,
        Mauro Carvalho Chehab <mchehab+samsung@...nel.org>,
        paulmck@...ux.ibm.com, stefan.wahren@...e.com,
        Linux PM <linux-pm@...r.kernel.org>,
        Chen-Yu Tsai <wens@...e.org>,
        Jagan Teki <jagan@...rulasolutions.com>,
        Andy Gross <andy.gross@...aro.org>, rui.zhang@...el.com,
        devicetree@...r.kernel.org, marc.w.gonzalez@...e.fr,
        Eduardo Valentin <edubezval@...il.com>,
        enric.balletbo@...labora.com, robh+dt@...nel.org,
        Jonathan.Cameron@...wei.com,
        Linux ARM <linux-arm-kernel@...ts.infradead.org>,
        Greg Kroah-Hartman <gregkh@...uxfoundation.org>,
        Linux Kernel Mailing List <linux-kernel@...r.kernel.org>,
        olof@...om.net, David Miller <davem@...emloft.net>
Subject: Re: [PATCH 2/3] thermal: sun50i: add thermal driver for h6

Hello,

On Fri, May 17, 2019 at 01:51:56AM +0800, Frank Lee wrote:
> > > +static int tsens_probe(struct platform_device *pdev)
> > > +{
> > > +     struct tsens_device *tmdev;
> > > +     struct device *dev = &pdev->dev;
> > > +     int ret;
> > > +
> > > +     tmdev = devm_kzalloc(dev, sizeof(*tmdev), GFP_KERNEL);
> > > +     if (!tmdev)
> > > +             return -ENOMEM;
> > > +
> > > +     tmdev->dev = dev;
> > > +     tmdev->chip = of_device_get_match_data(&pdev->dev);
> > > +     if (!tmdev->chip)
> > > +             return -EINVAL;
> > > +
> > > +     ret = tsens_init(tmdev);
> > > +     if (ret)
> > > +             return ret;
> > > +
> > > +     ret = tsens_register(tmdev);
> > > +     if (ret)
> > > +             return ret;
> > > +
> > > +     ret = tmdev->chip->enable(tmdev);
> > > +     if (ret)
> > > +             return ret;
> > >
> > > +     platform_set_drvdata(pdev, tmdev);
> >
> > Your registration should be the very last thing you do. Otherwise, you
> > have a small window where the get_temp callback can be called, but the
> > driver will not be functional yet.
> No. Anyway, ths data qcquisition is ms level.

Tz code can change in the future, and call the get_temp callback during
registration, and this would break. It's better to be correct, than make
dangerous assumptions. So platform_set_drvdata should be done somewhere 
prior to init_resource.

Enable should be after register though. Because otherwise you may be calling
tz update on non-registered tz from an interrupt handler.

> > > +     return ret;
> > > +}
> > > +

regards,
	o.

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ