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: <1239183618.61597285503620.JavaMail.epsvc@epcpadp1>
Date:   Thu, 13 Aug 2020 11:13:09 +0900
From:   Daejun Park <daejun7.park@...sung.com>
To:     Bart Van Assche <bvanassche@....org>,
        Daejun Park <daejun7.park@...sung.com>,
        "avri.altman@....com" <avri.altman@....com>,
        "jejb@...ux.ibm.com" <jejb@...ux.ibm.com>,
        "martin.petersen@...cle.com" <martin.petersen@...cle.com>,
        "asutoshd@...eaurora.org" <asutoshd@...eaurora.org>,
        "beanhuo@...ron.com" <beanhuo@...ron.com>,
        "stanley.chu@...iatek.com" <stanley.chu@...iatek.com>,
        "cang@...eaurora.org" <cang@...eaurora.org>,
        "tomas.winkler@...el.com" <tomas.winkler@...el.com>,
        ALIM AKHTAR <alim.akhtar@...sung.com>
CC:     "linux-scsi@...r.kernel.org" <linux-scsi@...r.kernel.org>,
        "linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>,
        Sang-yoon Oh <sangyoon.oh@...sung.com>,
        Sung-Jun Park <sungjun07.park@...sung.com>,
        yongmyung lee <ymhungry.lee@...sung.com>,
        Jinyoung CHOI <j-young.choi@...sung.com>,
        Adel Choi <adel.choi@...sung.com>,
        BoRam Shin <boram.shin@...sung.com>
Subject: Re: [PATCH v8 2/4] scsi: ufs: Introduce HPB feature

Hi Bart,

On 2020-08-06 02:11, Daejun Park wrote:
> > +static void ufshpb_issue_hpb_reset_query(struct ufs_hba *hba)
> > +{
> > +    int err;
> > +    int retries;
> > +
> > +    for (retries = 0; retries < HPB_RESET_REQ_RETRIES; retries++) {
> > +        err = ufshcd_query_flag(hba, UPIU_QUERY_OPCODE_SET_FLAG,
> > +                QUERY_FLAG_IDN_HPB_RESET, 0, NULL);
> > +        if (err)
> > +            dev_dbg(hba->dev,
> > +                "%s: failed with error %d, retries %d\n",
> > +                __func__, err, retries);
> > +        else
> > +            break;
> > +    }
> > +
> > +    if (err) {
> > +        dev_err(hba->dev,
> > +            "%s setting fHpbReset flag failed with error %d\n",
> > +            __func__, err);
> > +        return;
> > +    }
> > +}
> 
> Please change the "break" into an early return, remove the last
> occurrence "if (err)" and remove the final return statement.

OK, I will.

> 
> > +static void ufshpb_check_hpb_reset_query(struct ufs_hba *hba)
> > +{
> > +    int err;
> > +    bool flag_res = true;
> > +    int try = 0;
> > +
> > +    /* wait for the device to complete HPB reset query */
> > +    do {
> > +        if (++try == HPB_RESET_REQ_RETRIES)
> > +            break;
> > +
> > +        dev_info(hba->dev,
> > +            "%s start flag reset polling %d times\n",
> > +            __func__, try);
> > +
> > +        /* Poll fHpbReset flag to be cleared */
> > +        err = ufshcd_query_flag(hba, UPIU_QUERY_OPCODE_READ_FLAG,
> > +                QUERY_FLAG_IDN_HPB_RESET, 0, &flag_res);
> > +        usleep_range(1000, 1100);
> > +    } while (flag_res);
> > +
> > +    if (err) {
> > +        dev_err(hba->dev,
> > +            "%s reading fHpbReset flag failed with error %d\n",
> > +            __func__, err);
> > +        return;
> > +    }
> > +
> > +    if (flag_res) {
> > +        dev_err(hba->dev,
> > +            "%s fHpbReset was not cleared by the device\n",
> > +            __func__);
> > +    }
> > +}
> 
> Should "polling %d times" perhaps be changed into "attempt %d"?

I will change it.

> The "if (err)" statement may be reached without "err" having been
> initialized. Please fix.

OK, I will initialize err to 0.

> Additionally, please change the do-while loop into a for-loop, e.g. as
> follows:
> 
>     for (try = 0; try < HPB_RESET_REQ_RETRIES; try++)
>         ...

OK, I will change do-while to for-loop.

Thanks,

Daejun

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ