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:   Fri, 10 Sep 2021 15:58:04 +0000
From:   Avri Altman <Avri.Altman@....com>
To:     Bart Van Assche <bvanassche@....org>,
        "James E . J . Bottomley" <jejb@...ux.vnet.ibm.com>,
        "Martin K . Petersen" <martin.petersen@...cle.com>
CC:     "linux-scsi@...r.kernel.org" <linux-scsi@...r.kernel.org>,
        "linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>,
        Adrian Hunter <adrian.hunter@...el.com>,
        Bean Huo <beanhuo@...ron.com>,
        Guenter Roeck <linux@...ck-us.net>
Subject: RE: [PATCH v2 1/2] scsi: ufs: Probe for temperature notification
 support

 
> 
> On 9/8/21 11:34 PM, Avri Altman wrote:
> > +static bool ufs_temp_enabled(struct ufs_hba *hba, struct
> > +ufs_hwmon_data *data) {
> > +     u32 ee_mask;
> > +
> > +     if (ufshcd_query_attr(hba, UPIU_QUERY_OPCODE_READ_ATTR,
> > +                           QUERY_ATTR_IDN_EE_CONTROL, 0, 0, &ee_mask))
> > +             return false;
> > +
> > +     return (data->mask & ee_mask & MASK_EE_TOO_HIGH_TEMP) ||
> > +             (data->mask & ee_mask & MASK_EE_TOO_LOW_TEMP); }
> 
> The above function uses data->mask but not data so it's probably better to
> pass
> data->mask directly as the second argument.
Done.

> 
> > +static bool ufs_temp_valid(struct ufs_hba *hba, struct ufs_hwmon_data
> *data,
> > +                        enum attr_idn idn, u32 value) {
> > +     return (idn == QUERY_ATTR_IDN_CASE_ROUGH_TEMP && value >= 1
> &&
> > +             value <= 250 && ufs_temp_enabled(hba, data)) ||
> > +           (idn == QUERY_ATTR_IDN_HIGH_TEMP_BOUND && value >= 100
> &&
> > +            value <= 250) ||
> > +           (idn == QUERY_ATTR_IDN_LOW_TEMP_BOUND && value >= 1 &&
> > +            value <= 80);
> > +}
> 
> Same comment for this function - if the above comment is addressed 'mask'
> can be passed as an argument instead of 'data'.
Done.
 
> > +static int ufs_get_temp(struct ufs_hba *hba, struct ufs_hwmon_data
> *data,
> > +                     enum attr_idn idn) {
> > +     u32 value;
> > +
> > +     if (ufshcd_query_attr(hba, UPIU_QUERY_OPCODE_READ_ATTR, idn, 0,
> 0,
> > +         &value))
> > +             return 0;
> > +
> > +     if (ufs_temp_valid(hba, data, idn, value))
> > +             return value - 80;
> > +
> > +     return 0;
> > +}
> 
> Same comment here.
Done.
 
> > +void ufs_hwmon_remove(struct ufs_hba *hba) {
> > +     if (hba->hwmon_device) {
> > +             struct ufs_hwmon_data *data =
> > +                     dev_get_drvdata(hba->hwmon_device);
> > +
> > +             hwmon_device_unregister(hba->hwmon_device);
> > +             hba->hwmon_device = NULL;
> > +             kfree(data);
> > +     }
> > +}
> 
> Please use the "early return" style since that is the most widely used style in
> the Linux kernel (if (!hba->hwmon_device) return).
Done.


> 
> Thanks,
> 
> Bart.

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ