Linux ATA/IDE development
 help / color / mirror / Atom feed
From: Markus Elfring <Markus.Elfring@web.de>
To: Niklas Cassel <cassel@kernel.org>,
	Radhey Shyam Pandey <radhey.shyam.pandey@amd.com>,
	Damien Le Moal <dlemoal@kernel.org>, Jens Axboe <axboe@kernel.dk>,
	Michal Simek <michal.simek@amd.com>,
	Philipp Zabel <p.zabel@pengutronix.de>,
	linux-ide@vger.kernel.org, kernel-janitors@vger.kernel.org
Cc: LKML <linux-kernel@vger.kernel.org>, git@amd.com
Subject: Re: [PATCH v3] ata: ahci_ceva: fix error handling for Xilinx GT PHY support
Date: Mon, 19 Feb 2024 16:57:04 +0100	[thread overview]
Message-ID: <9427c0fd-f48a-4104-ac7e-2929be3562af@web.de> (raw)
In-Reply-To: <ZdMp+QBiays6fprk@x1-carbon>

> > Platform clock and phy error resources are not cleaned up in Xilinx GT PHY
> > error path.
> >
> > To fix introduce the function ceva_ahci_platform_enable_resources()
> Applied:
> https://git.kernel.org/pub/scm/linux/kernel/git/libata/linux.git/log/?h=for-6.8-fixes

The error code “-EINVAL” was set before the statement “goto disable_resources”
multiple times in the adjusted implementation of the function “ceva_ahci_probe”.
I suggest to add a jump target so that a bit of exception handling
can be better reused at the end of this function.


How do you think about to apply the following script for the semantic
patch language (Coccinelle software) accordingly?


@replacement1@
identifier rc;
@@
 <+...
 if (...)
 {
    ... when != rc
-   rc = -EINVAL;
    goto
-        disable_resources
+        e_inval
    ;
 }
 ...+>
 return 0;
+
+e_inval:
+rc = -EINVAL;
 disable_resources:
 ahci_platform_disable_resources(hpriv);

@replacement2 disable neg_if, drop_else@
identifier replacement1.rc;
statement is;
@@
 if (...)
    is
 else
 {
    ... when != rc
-   rc = -EINVAL;
    goto
-        disable_resources
+        e_inval
    ;
 }


Regards,
Markus

  reply	other threads:[~2024-02-19 16:02 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-02-16 18:14 [PATCH v3] ata: ahci_ceva: fix error handling for Xilinx GT PHY support Radhey Shyam Pandey
2024-02-19 10:14 ` Niklas Cassel
2024-02-19 15:57   ` Markus Elfring [this message]
2024-02-19 18:42     ` Pandey, Radhey Shyam
2024-02-19 19:14       ` Niklas Cassel

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=9427c0fd-f48a-4104-ac7e-2929be3562af@web.de \
    --to=markus.elfring@web.de \
    --cc=axboe@kernel.dk \
    --cc=cassel@kernel.org \
    --cc=dlemoal@kernel.org \
    --cc=git@amd.com \
    --cc=kernel-janitors@vger.kernel.org \
    --cc=linux-ide@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=michal.simek@amd.com \
    --cc=p.zabel@pengutronix.de \
    --cc=radhey.shyam.pandey@amd.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