public inbox for linux-pci@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH -next] PCI: endpoint: Use helper function IS_ERR_OR_NULL()
@ 2023-08-17  7:09 Ruan Jinjie
  2023-08-23  6:12 ` Manivannan Sadhasivam
  2023-08-30  4:44 ` Krzysztof Wilczyński
  0 siblings, 2 replies; 3+ messages in thread
From: Ruan Jinjie @ 2023-08-17  7:09 UTC (permalink / raw)
  To: linux-pci, Lorenzo Pieralisi, Krzysztof Wilczyński,
	Manivannan Sadhasivam, Kishon Vijay Abraham I, Bjorn Helgaas
  Cc: ruanjinjie

Use IS_ERR_OR_NULL() instead of open-coding it
to simplify the code.

Signed-off-by: Ruan Jinjie <ruanjinjie@huawei.com>
---
 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


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH -next] PCI: endpoint: Use helper function IS_ERR_OR_NULL()
  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
  2023-08-30  4:44 ` Krzysztof Wilczyński
  1 sibling, 0 replies; 3+ messages in thread
From: Manivannan Sadhasivam @ 2023-08-23  6:12 UTC (permalink / raw)
  To: Ruan Jinjie
  Cc: linux-pci, Lorenzo Pieralisi, Krzysztof Wilczyński,
	Manivannan Sadhasivam, Kishon Vijay Abraham I, Bjorn Helgaas

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
> 

-- 
மணிவண்ணன் சதாசிவம்

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH -next] PCI: endpoint: Use helper function IS_ERR_OR_NULL()
  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
@ 2023-08-30  4:44 ` Krzysztof Wilczyński
  1 sibling, 0 replies; 3+ messages in thread
From: Krzysztof Wilczyński @ 2023-08-30  4:44 UTC (permalink / raw)
  To: Ruan Jinjie
  Cc: linux-pci, Lorenzo Pieralisi, Manivannan Sadhasivam,
	Kishon Vijay Abraham I, Bjorn Helgaas

Hello,

> Use IS_ERR_OR_NULL() instead of open-coding it
> to simplify the code.

Applied to endpoint, thank you!

[1/1] PCI: endpoint: Use IS_ERR_OR_NULL() helper function
      https://git.kernel.org/pci/pci/c/6f6a75878e64

	Krzysztof

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2023-08-30  4:45 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
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
2023-08-30  4:44 ` Krzysztof Wilczyński

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox