mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Damien Le Moal <dlemoal@kernel.org>
To: Qianfeng Rong <rongqianfeng@vivo.com>,
	Niklas Cassel <cassel@kernel.org>,
	linux-ide@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH] ata: ahci_xgene: Use int type for 'rc' to store error codes
Date: Tue, 26 Aug 2025 14:09:05 +0900	[thread overview]
Message-ID: <138dde32-e528-4731-b766-4f26dd9366d1@kernel.org> (raw)
In-Reply-To: <20250826040219.133959-1-rongqianfeng@vivo.com>

On 8/26/25 13:02, Qianfeng Rong wrote:
> Use int instead of u32 for 'rc' variable to store negative error codes
> returned by ahci_do_softreset().
> 
> Signed-off-by: Qianfeng Rong <rongqianfeng@vivo.com>
> ---
>  drivers/ata/ahci_xgene.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/ata/ahci_xgene.c b/drivers/ata/ahci_xgene.c
> index 5d5a51a77f5d..8d01c105fd44 100644
> --- a/drivers/ata/ahci_xgene.c
> +++ b/drivers/ata/ahci_xgene.c
> @@ -450,7 +450,7 @@ static int xgene_ahci_pmp_softreset(struct ata_link *link, unsigned int *class,
>  {
>  	int pmp = sata_srst_pmp(link);
>  	struct ata_port *ap = link->ap;
> -	u32 rc;
> +	int rc;
>  	void __iomem *port_mmio = ahci_port_base(ap);
>  	u32 port_fbs;

If you fix this, please fix it properly: the rc variable is not needed at all in
that function. You can just do:

diff --git a/drivers/ata/ahci_xgene.c b/drivers/ata/ahci_xgene.c
index 5d5a51a77f5d..a6d964f7184c 100644
--- a/drivers/ata/ahci_xgene.c
+++ b/drivers/ata/ahci_xgene.c
@@ -450,7 +450,6 @@ static int xgene_ahci_pmp_softreset(struct ata_link *link,
unsigned int *class,
 {
        int pmp = sata_srst_pmp(link);
        struct ata_port *ap = link->ap;
-       u32 rc;
        void __iomem *port_mmio = ahci_port_base(ap);
        u32 port_fbs;

@@ -463,9 +462,7 @@ static int xgene_ahci_pmp_softreset(struct ata_link *link,
unsigned int *class,
        port_fbs |= pmp << PORT_FBS_DEV_OFFSET;
        writel(port_fbs, port_mmio + PORT_FBS);

-       rc = ahci_do_softreset(link, class, pmp, deadline, ahci_check_ready);
-
-       return rc;
+       return ahci_do_softreset(link, class, pmp, deadline, ahci_check_ready);
 }


>  
> @@ -500,7 +500,7 @@ static int xgene_ahci_softreset(struct ata_link *link, unsigned int *class,
>  	u32 port_fbs;
>  	u32 port_fbs_save;
>  	u32 retry = 1;
> -	u32 rc;
> +	int rc;
>  
>  	port_fbs_save = readl(port_mmio + PORT_FBS);
>  


-- 
Damien Le Moal
Western Digital Research

  reply	other threads:[~2025-08-26  5:09 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-08-26  4:02 Qianfeng Rong
2025-08-26  5:09 ` Damien Le Moal [this message]
2025-08-26  6:58   ` Qianfeng Rong

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=138dde32-e528-4731-b766-4f26dd9366d1@kernel.org \
    --to=dlemoal@kernel.org \
    --cc=cassel@kernel.org \
    --cc=linux-ide@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=rongqianfeng@vivo.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®