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:   Mon, 11 Apr 2022 08:49:15 +0000
From:   <Claudiu.Beznea@...rochip.com>
To:     <cgel.zte@...il.com>, <Nicolas.Ferre@...rochip.com>
CC:     <davem@...emloft.net>, <kuba@...nel.org>, <pabeni@...hat.com>,
        <netdev@...r.kernel.org>, <linux-kernel@...r.kernel.org>,
        <chi.minghao@....com.cn>, <zealci@....com.cn>
Subject: Re: [PATCH] net/cadence: using pm_runtime_resume_and_get instead of
 pm_runtime_get_sync

On 11.04.2022 04:38, cgel.zte@...il.com wrote:
> EXTERNAL EMAIL: Do not click links or open attachments unless you know the content is safe
> 
> From: Minghao Chi <chi.minghao@....com.cn>
> 
> Using pm_runtime_resume_and_get is more appropriate
> for simplifing code
> 
> Reported-by: Zeal Robot <zealci@....com.cn>
> Signed-off-by: Minghao Chi <chi.minghao@....com.cn>

Reviewed-by: Claudiu Beznea <claudiu.beznea@...rochip.com>


> ---
>  drivers/net/ethernet/cadence/macb_main.c | 22 ++++++++--------------
>  1 file changed, 8 insertions(+), 14 deletions(-)
> 
> diff --git a/drivers/net/ethernet/cadence/macb_main.c b/drivers/net/ethernet/cadence/macb_main.c
> index 800d5ced5800..5555daee6f13 100644
> --- a/drivers/net/ethernet/cadence/macb_main.c
> +++ b/drivers/net/ethernet/cadence/macb_main.c
> @@ -337,11 +337,9 @@ static int macb_mdio_read(struct mii_bus *bus, int mii_id, int regnum)
>         struct macb *bp = bus->priv;
>         int status;
> 
> -       status = pm_runtime_get_sync(&bp->pdev->dev);
> -       if (status < 0) {
> -               pm_runtime_put_noidle(&bp->pdev->dev);
> +       status = pm_runtime_resume_and_get(&bp->pdev->dev);
> +       if (status < 0)
>                 goto mdio_pm_exit;
> -       }
> 
>         status = macb_mdio_wait_for_idle(bp);
>         if (status < 0)
> @@ -391,11 +389,9 @@ static int macb_mdio_write(struct mii_bus *bus, int mii_id, int regnum,
>         struct macb *bp = bus->priv;
>         int status;
> 
> -       status = pm_runtime_get_sync(&bp->pdev->dev);
> -       if (status < 0) {
> -               pm_runtime_put_noidle(&bp->pdev->dev);
> +       status = pm_runtime_resume_and_get(&bp->pdev->dev);
> +       if (status < 0)
>                 goto mdio_pm_exit;
> -       }
> 
>         status = macb_mdio_wait_for_idle(bp);
>         if (status < 0)
> @@ -2745,9 +2741,9 @@ static int macb_open(struct net_device *dev)
> 
>         netdev_dbg(bp->dev, "open\n");
> 
> -       err = pm_runtime_get_sync(&bp->pdev->dev);
> +       err = pm_runtime_resume_and_get(&bp->pdev->dev);
>         if (err < 0)
> -               goto pm_exit;
> +               return err;
> 
>         /* RX buffers initialization */
>         macb_init_rx_buffer_size(bp, bufsz);
> @@ -4134,11 +4130,9 @@ static int at91ether_open(struct net_device *dev)
>         u32 ctl;
>         int ret;
> 
> -       ret = pm_runtime_get_sync(&lp->pdev->dev);
> -       if (ret < 0) {
> -               pm_runtime_put_noidle(&lp->pdev->dev);
> +       ret = pm_runtime_resume_and_get(&lp->pdev->dev);
> +       if (ret < 0)
>                 return ret;
> -       }
> 
>         /* Clear internal statistics */
>         ctl = macb_readl(lp, NCR);
> --
> 2.25.1
> 

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ