[PATCH] pci: cleanup coding styling in pci-driver.c

From: Jingyu Wang
Date: Mon Sep 05 2022 - 10:02:20 EST


Signed-off-by: Jingyu Wang <jingyuwang_vip@xxxxxxx>
---
drivers/pci/pci-driver.c | 11 ++++++++---
1 file changed, 8 insertions(+), 3 deletions(-)

diff --git a/drivers/pci/pci-driver.c b/drivers/pci/pci-driver.c
index 49238ddd39ee..bba486f5e5fe 100644
--- a/drivers/pci/pci-driver.c
+++ b/drivers/pci/pci-driver.c
@@ -204,6 +204,7 @@ static ssize_t new_id_store(struct device_driver *driver, const char *buf,

if (fields != 7) {
struct pci_dev *pdev = kzalloc(sizeof(*pdev), GFP_KERNEL);
+
if (!pdev)
return -ENOMEM;

@@ -222,8 +223,8 @@ static ssize_t new_id_store(struct device_driver *driver, const char *buf,
return retval;
}

- /* Only accept driver_data values that match an existing id_table
- entry */
+ /* Only accept driver_data values that match an existing id_table entry
+ */
if (ids) {
retval = -EINVAL;
while (ids->vendor || ids->subvendor || ids->class_mask) {
@@ -272,6 +273,7 @@ static ssize_t remove_id_store(struct device_driver *driver, const char *buf,
spin_lock(&pdrv->dynids.lock);
list_for_each_entry_safe(dynid, n, &pdrv->dynids.list, node) {
struct pci_device_id *id = &dynid->id;
+
if ((id->vendor == vendor) &&
(id->device == device) &&
(subvendor == PCI_ANY_ID || id->subvendor == subvendor) &&
@@ -537,6 +539,7 @@ static int pci_restore_standard_config(struct pci_dev *pci_dev)

if (pci_dev->current_state != PCI_D0) {
int error = pci_set_power_state(pci_dev, PCI_D0);
+
if (error)
return error;
}
@@ -705,6 +708,7 @@ static int pci_pm_prepare(struct device *dev)

if (pm && pm->prepare) {
int error = pm->prepare(dev);
+
if (error < 0)
return error;

@@ -1364,7 +1368,7 @@ static int pci_pm_runtime_idle(struct device *dev)
return 0;

if (!pm)
- return -ENOSYS;
+ return -ENODEV;

if (pm->runtime_idle)
return pm->runtime_idle(dev);
@@ -1471,6 +1475,7 @@ struct pci_driver *pci_dev_driver(const struct pci_dev *dev)
return dev->driver;
else {
int i;
+
for (i = 0; i <= PCI_ROM_RESOURCE; i++)
if (dev->resource[i].flags & IORESOURCE_BUSY)
return &pci_compat_driver;

base-commit: e47eb90a0a9ae20b82635b9b99a8d0979b757ad8
--
2.34.1