From: Manivannan Sadhasivam <mani@kernel.org>
To: Ruan Jinjie <ruanjinjie@huawei.com>
Cc: linux-pci@vger.kernel.org,
"Lorenzo Pieralisi" <lpieralisi@kernel.org>,
"Krzysztof Wilczyński" <kw@linux.com>,
"Manivannan Sadhasivam" <mani@kernel.org>,
"Kishon Vijay Abraham I" <kishon@kernel.org>,
"Bjorn Helgaas" <bhelgaas@google.com>
Subject: Re: [PATCH -next] PCI: endpoint: Use helper function IS_ERR_OR_NULL()
Date: Wed, 23 Aug 2023 11:42:25 +0530 [thread overview]
Message-ID: <20230823061225.GB3737@thinkpad> (raw)
In-Reply-To: <20230817070932.341667-1-ruanjinjie@huawei.com>
On Thu, Aug 17, 2023 at 03:09:31PM +0800, Ruan Jinjie wrote:
> Use IS_ERR_OR_NULL() instead of open-coding it
> to simplify the code.
>
> Signed-off-by: Ruan Jinjie <ruanjinjie@huawei.com>
Reviewed-by: Manivannan Sadhasivam <mani@kernel.org>
- Mani
> ---
> drivers/pci/endpoint/pci-epc-core.c | 12 ++++++------
> 1 file changed, 6 insertions(+), 6 deletions(-)
>
> diff --git a/drivers/pci/endpoint/pci-epc-core.c b/drivers/pci/endpoint/pci-epc-core.c
> index 5a4a8b0be626..fe421d46a8a4 100644
> --- a/drivers/pci/endpoint/pci-epc-core.c
> +++ b/drivers/pci/endpoint/pci-epc-core.c
> @@ -38,7 +38,7 @@ static int devm_pci_epc_match(struct device *dev, void *res, void *match_data)
> */
> void pci_epc_put(struct pci_epc *epc)
> {
> - if (!epc || IS_ERR(epc))
> + if (IS_ERR_OR_NULL(epc))
> return;
>
> module_put(epc->ops->owner);
> @@ -660,7 +660,7 @@ void pci_epc_remove_epf(struct pci_epc *epc, struct pci_epf *epf,
> struct list_head *list;
> u32 func_no = 0;
>
> - if (!epc || IS_ERR(epc) || !epf)
> + if (IS_ERR_OR_NULL(epc) || !epf)
> return;
>
> if (type == PRIMARY_INTERFACE) {
> @@ -691,7 +691,7 @@ void pci_epc_linkup(struct pci_epc *epc)
> {
> struct pci_epf *epf;
>
> - if (!epc || IS_ERR(epc))
> + if (IS_ERR_OR_NULL(epc))
> return;
>
> mutex_lock(&epc->list_lock);
> @@ -717,7 +717,7 @@ void pci_epc_linkdown(struct pci_epc *epc)
> {
> struct pci_epf *epf;
>
> - if (!epc || IS_ERR(epc))
> + if (IS_ERR_OR_NULL(epc))
> return;
>
> mutex_lock(&epc->list_lock);
> @@ -743,7 +743,7 @@ void pci_epc_init_notify(struct pci_epc *epc)
> {
> struct pci_epf *epf;
>
> - if (!epc || IS_ERR(epc))
> + if (IS_ERR_OR_NULL(epc))
> return;
>
> mutex_lock(&epc->list_lock);
> @@ -769,7 +769,7 @@ void pci_epc_bme_notify(struct pci_epc *epc)
> {
> struct pci_epf *epf;
>
> - if (!epc || IS_ERR(epc))
> + if (IS_ERR_OR_NULL(epc))
> return;
>
> mutex_lock(&epc->list_lock);
> --
> 2.34.1
>
--
மணிவண்ணன் சதாசிவம்
next prev parent reply other threads:[~2023-08-23 6:12 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-08-17 7:09 [PATCH -next] PCI: endpoint: Use helper function IS_ERR_OR_NULL() Ruan Jinjie
2023-08-23 6:12 ` Manivannan Sadhasivam [this message]
2023-08-30 4:44 ` Krzysztof Wilczyński
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=20230823061225.GB3737@thinkpad \
--to=mani@kernel.org \
--cc=bhelgaas@google.com \
--cc=kishon@kernel.org \
--cc=kw@linux.com \
--cc=linux-pci@vger.kernel.org \
--cc=lpieralisi@kernel.org \
--cc=ruanjinjie@huawei.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