public inbox for stable@vger.kernel.org
 help / color / mirror / Atom feed
From: Niklas Schnelle <schnelle@linux.ibm.com>
To: stable@vger.kernel.org
Cc: Niklas Schnelle <schnelle@linux.ibm.com>
Subject: [PATCH 5.14 1/2] s390/pci: cleanup resources only if necessary
Date: Thu, 21 Oct 2021 16:13:40 +0200	[thread overview]
Message-ID: <20211021141341.344756-2-schnelle@linux.ibm.com> (raw)
In-Reply-To: <20211021141341.344756-1-schnelle@linux.ibm.com>

commit 023cc3cb1e4baa8d1900a4f2e999701c82ce2b6c upstream.

It's currently safe to call zpci_cleanup_bus_resources() even if the
resources were never created but it makes no sense so check
zdev->has_resources before we call zpci_cleanup_bus_resources() in
zpci_release_device().

Reviewed-by: Matthew Rosato <mjrosato@linux.ibm.com>
Acked-by: Pierre Morel <pmorel@linux.ibm.com>
Signed-off-by: Niklas Schnelle <schnelle@linux.ibm.com>
---
 arch/s390/pci/pci.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/arch/s390/pci/pci.c b/arch/s390/pci/pci.c
index 34839bad33e4..5e234cb2ad7b 100644
--- a/arch/s390/pci/pci.c
+++ b/arch/s390/pci/pci.c
@@ -829,7 +829,8 @@ void zpci_release_device(struct kref *kref)
 	case ZPCI_FN_STATE_STANDBY:
 		if (zdev->has_hp_slot)
 			zpci_exit_slot(zdev);
-		zpci_cleanup_bus_resources(zdev);
+		if (zdev->has_resources)
+			zpci_cleanup_bus_resources(zdev);
 		zpci_bus_device_unregister(zdev);
 		zpci_destroy_iommu(zdev);
 		fallthrough;
-- 
2.25.1


  reply	other threads:[~2021-10-21 14:13 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-10-21 14:13 [PATCH 5.14 0/2] s390/pci: fix zpci_zdev_put() on reserve Niklas Schnelle
2021-10-21 14:13 ` Niklas Schnelle [this message]
2021-10-24 12:04   ` [PATCH 5.14 1/2] s390/pci: cleanup resources only if necessary Greg KH
2021-10-25  7:48     ` Greg KH
2021-10-25  8:43       ` Niklas Schnelle
2021-10-25  8:49         ` Greg KH
2021-10-21 14:13 ` [PATCH 5.14 2/2] s390/pci: fix zpci_zdev_put() on reserve Niklas Schnelle
2021-10-25  7:49   ` Greg KH
2021-10-25  8:49     ` Niklas Schnelle

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=20211021141341.344756-2-schnelle@linux.ibm.com \
    --to=schnelle@linux.ibm.com \
    --cc=stable@vger.kernel.org \
    /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