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]
Date:   Thu, 1 Sep 2022 07:28:39 -0700
From:   Guenter Roeck <linux@...ck-us.net>
To:     "Farber, Eliav" <farbere@...zon.com>
Cc:     Andy Shevchenko <andriy.shevchenko@...el.com>, jdelvare@...e.com,
        robh+dt@...nel.org, p.zabel@...gutronix.de, rtanwar@...linear.com,
        linux-hwmon@...r.kernel.org, devicetree@...r.kernel.org,
        linux-kernel@...r.kernel.org, talel@...zon.com, hhhawa@...zon.com,
        jonnyc@...zon.com, hanochu@...zon.com, ronenk@...zon.com,
        itamark@...zon.com, shellykz@...zon.com, shorer@...zon.com,
        amitlavi@...zon.com, almogbs@...zon.com, dkl@...zon.com
Subject: Re: [PATCH v3 18/19] hwmon: (mr75203) add debugfs to read and write
 temperature coefficients

On Thu, Sep 01, 2022 at 09:54:21AM +0300, Farber, Eliav wrote:
> On 8/31/2022 3:14 PM, Andy Shevchenko wrote:
> > On Tue, Aug 30, 2022 at 07:22:11PM +0000, Eliav Farber wrote:
> > > This change adds debugfs to read and write temperature sensor
> > > coefficients
> > > - g, h, j and cal5.
> > > 
> > > The coefficients can vary between product and product, so it can be very
> > > useful to be able to modify them on the fly during the calibration
> > > process.
> > > 
> > > e.g.:
> > > 
> > > cat /sys/kernel/debug/940f23d0000.pvt/ts_coeff_cal5
> > > 4096
> > > 
> > > echo 83000 > sys/kernel/debug/940f23d0000.pvt/ts_coeff_g
> > 
> > ...
> > 
> > > +     pvt->dbgfs_dir = debugfs_create_dir(dev_name(dev), NULL);
> > 
> > > +     if (!pvt->dbgfs_dir) {
> > > +             dev_err(dev, "Failed to create dbgfs_dir\n");
> > > +             return -EINVAL;
> > > +     }
> > 
> > No, just don't check the return value of debugfs API calls.
> > 
> Do you mean that I should just do:
> debugfs_create_dir(dev_name(dev), NULL);
> Can you please explain why it's OK to ignore the return value?
> 

Because that is how debugfs code is supposed to be implemented.
Other debugfs code checks if the dir parameter passed to it is NULL
and do nothing if it is. This reduces code size overall by avoiding
unnecessary error checks.

Guenter

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ