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] [day] [month] [year] [list]
Date:   Tue, 10 Apr 2018 18:25:15 +0300
From:   Andy Shevchenko <andy.shevchenko@...il.com>
To:     Jia-Ju Bai <baijiaju1990@...il.com>
Cc:     Darren Hart <dvhart@...radead.org>,
        Andy Shevchenko <andy@...radead.org>,
        Platform Driver <platform-driver-x86@...r.kernel.org>,
        Linux Kernel Mailing List <linux-kernel@...r.kernel.org>
Subject: Re: [PATCH] platform: x86: intel_scu_ipc: Replace mdelay with
 usleep_range in intel_scu_ipc_i2c_cntrl

On Tue, Apr 10, 2018 at 3:57 PM, Jia-Ju Bai <baijiaju1990@...il.com> wrote:
> intel_scu_ipc_i2c_cntrl() calls mutex_lock(), which indicates
> this function is not called in atomic context.
>
> Despite never getting called from atomic context,
> intel_scu_ipc_i2c_cntrl() calls mdelay to busily wait.
> This is not necessary and can be replaced with usleep_range to
> avoid busy waiting.
>
> This is found by a static analysis tool named DCNS written by myself.
> And I also manually check it.

I'm not sure we even need that delay at all.
Anyway, pushed to my review and testing queue, thanks!

>
> Signed-off-by: Jia-Ju Bai <baijiaju1990@...il.com>
> ---
>  drivers/platform/x86/intel_scu_ipc.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/platform/x86/intel_scu_ipc.c b/drivers/platform/x86/intel_scu_ipc.c
> index 2c85f75..75c8fef 100644
> --- a/drivers/platform/x86/intel_scu_ipc.c
> +++ b/drivers/platform/x86/intel_scu_ipc.c
> @@ -584,11 +584,11 @@ int intel_scu_ipc_i2c_cntrl(u32 addr, u32 *data)
>         if (cmd == IPC_I2C_READ) {
>                 writel(addr, scu->i2c_base + IPC_I2C_CNTRL_ADDR);
>                 /* Write not getting updated without delay */
> -               mdelay(1);
> +               usleep_range(1000, 2000);
>                 *data = readl(scu->i2c_base + I2C_DATA_ADDR);
>         } else if (cmd == IPC_I2C_WRITE) {
>                 writel(*data, scu->i2c_base + I2C_DATA_ADDR);
> -               mdelay(1);
> +               usleep_range(1000, 2000);
>                 writel(addr, scu->i2c_base + IPC_I2C_CNTRL_ADDR);
>         } else {
>                 dev_err(scu->dev,
> --
> 1.9.1
>



-- 
With Best Regards,
Andy Shevchenko

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ