Re: [PATCH v3 1/4] s390/pci: Fix leak of struct pci_dev reference in zpci_report_status()

From: Benjamin Block

Date: Fri Sep 18 2026 - 04:41:54 EST


On Wed, Sep 16, 2026 at 05:14:10PM +0200, Niklas Schnelle wrote:
> diff --git a/arch/s390/pci/pci_report.c b/arch/s390/pci/pci_report.c
> index 7030f7052926..867419779219 100644
> --- a/arch/s390/pci/pci_report.c
> +++ b/arch/s390/pci/pci_report.c
> @@ -89,7 +89,8 @@ static struct debug_view debug_log_view = {
>
> /**
> * zpci_report_status - Report the status of operations on a PCI device
> - * @zdev: The PCI device for which to report status
> + * @zdev: The zPCI device for which to report status
> + * @pdev: The PCI device associated with the zdev if any, NULL otherwise
> * @operation: A string representing the operation reported
> * @status: A string representing the status of the operation
> *
> @@ -103,15 +104,15 @@ static struct debug_view debug_log_view = {
> *
> * Return: 0 on success an error code < 0 otherwise.
> */
> -int zpci_report_status(struct zpci_dev *zdev, const char *operation, const char *status)
> +int zpci_report_status(struct zpci_dev *zdev, struct pci_dev *pdev,
> + const char *operation, const char *status)

One small thing that is in no way critical: I wonder whether we could make the
`pdev` const. We don't do anything with it apart from reading some attributes
and such.

> {
> struct zpci_report_error *report;
> struct pci_driver *driver = NULL;
> - struct pci_dev *pdev = NULL;

--
Best Regards, Benjamin Block / Linux on IBM Z Kernel Development
IBM Deutschland Research & Development GmbH / https://www.ibm.com/privacy
Vors. Aufs.-R.: Wolfgang Wendt / Geschäftsführung: David Faller
Sitz der Ges.: Ehningen / Registergericht: AmtsG Stuttgart, HRB 243294