Re: [PATCH v23 3/5] PCI: Avoid saving config space state if inaccessible

[email protected]
Newsgroups org.kernel.vger.linux-s390,org.kernel.vger.linux-pci
Message-ID <[email protected]>
Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
- [Low] Function parameter `msg` should be declared as `const char *` instead of `char *`.
--

--- Patch [3]: [PATCH v23 3/5] PCI: Avoid saving config space state if inaccessible ---
commit d2cfd742f2dfe4c4445b198bcb7010bd9ef42491
Author: Farhan Ali <[email protected]>

PCI: Avoid saving config space state if inaccessible

This commit modifies the PCI reset process to avoid saving the device's
configuration space state if it is inaccessible. It checks the PCI_COMMAND
register to determine accessibility before attempting to save the state.

> diff --git a/drivers/pci/pci.c b/drivers/pci/pci.c
> index 350bae907ebf8..e8d7de77241a6 100644
> --- a/drivers/pci/pci.c
> +++ b/drivers/pci/pci.c

[ ... ]

> @@ -713,6 +713,27 @@ u16 pci_find_dvsec_capability(struct pci_dev *dev, u16 vendor, u16 dvsec)
>  }
>  EXPORT_SYMBOL_GPL(pci_find_dvsec_capability);
>  
> +static bool pci_dev_config_accessible(struct pci_dev *dev, char *msg)

[Severity: Low]
This isn't a bug, but should the msg parameter be declared as const char *
instead of char *?

The function is called with string literals, which violates const
correctness and can trigger discarded-qualifier compiler warnings.

> +{
> +	u32 val;
> +
> +	/*
> +	 * If device's config space is inaccessible it can return ~0 for

[ ... ]

> @@ -5059,6 +5080,9 @@ static void pci_dev_save_and_disable(struct pci_dev *dev)
>  	 */
>  	pci_set_power_state(dev, PCI_D0);
>  
> +	if (!pci_dev_config_accessible(dev, "save state"))
> +		return;
> +
>  	pci_save_state(dev);

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/[email protected]?part=3
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.