Skip to contentSkip to conversation

staging: kpc2000: fix error return code in kp2000_pcie_probe()

PATCH Superseded Wei Yongjun 2 participants 6 messages May 6, 2020

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 staging: kpc2000: fix error return code in kp2000_pcie_probe()

Fix to return a negative error code from the error handling case instead of 0, as done elsewhere in this function. Also removed var 'rv' since we can use 'err' instead.

---
 drivers/staging/kpc2000/kpc2000/core.c | 7 +++----
 1 file changed, 3 insertions(+), 4 deletions(-)
drivers/staging/kpc2000/kpc2000/core.c +3 -4
index 7b00d7069e21..14e07742dc9d 100644
@@ -298,7 +298,6 @@ static int kp2000_pcie_probe(struct pci_dev *pdev,
 {
 	int err = 0;
 	struct kp2000_device *pcard;
-	int rv;
 	unsigned long reg_bar_phys_addr;
 	unsigned long reg_bar_phys_len;
 	unsigned long dma_bar_phys_addr;
@@ -445,11 +444,11 @@ static int kp2000_pcie_probe(struct pci_dev *pdev,
 	if (err < 0)
 		goto err_release_dma;
 
-	rv = request_irq(pcard->pdev->irq, kp2000_irq_handler, IRQF_SHARED,
+	err = request_irq(pcard->pdev->irq, kp2000_irq_handler, IRQF_SHARED,
 			 pcard->name, pcard);
-	if (rv) {
+	if (err) {
 		dev_err(&pcard->pdev->dev,
-			"%s: failed to request_irq: %d\n", __func__, rv);
+			"%s: failed to request_irq: %d\n", __func__, err);
 		goto err_disable_msi;
 	}
 
#1 lore raw
Quoted 22 lines · Wei Yongjun

Fix to return a negative error code from the error handling case instead of 0, as done elsewhere in this function. Also removed var 'rv' since we can use 'err' instead.

---
 drivers/staging/kpc2000/kpc2000/core.c | 7 +++----
 1 file changed, 3 insertions(+), 4 deletions(-)
drivers/staging/kpc2000/kpc2000/core.c +0 -1
index 7b00d7069e21..14e07742dc9d 100644
@@ -298,7 +298,6 @@ static int kp2000_pcie_probe(struct pci_dev *pdev,
 {
 	int err = 0;
 	struct kp2000_device *pcard;
-	int rv;
 	unsigned long reg_bar_phys_addr;
 	unsigned long reg_bar_phys_len;
 	unsigned long dma_bar_phys_addr;

drivers/staging/kpc2000/kpc2000/core.c static int kp2000_pcie_probe(struct pci_dev *pdev, · line 448

Quoted 6 lines
drivers/staging/kpc2000/kpc2000/core.c +1 -1
@@ -445,11 +444,11 @@ static int kp2000_pcie_probe(struct pci_dev *pdev,
 	if (err < 0)
 		goto err_release_dma;
 
-	rv = request_irq(pcard->pdev->irq, kp2000_irq_handler, IRQF_SHARED,
+	err = request_irq(pcard->pdev->irq, kp2000_irq_handler, IRQF_SHARED,
 			 pcard->name, pcard);
                        ^

Could you add a space character here so the white space still aligns?

Otherwise it looks good. :)

regards,
dan carpenter

#2 lore raw
In reply to Wei Yongjun
Quoted 5 lines · Wei Yongjun

Fix to return a negative error code from the error handling case instead of 0, as done elsewhere in this function. Also removed var 'rv' since we can use 'err' instead.

Also could you add a Fixes tag? This goes all the way back to the original commit:

Fixes 7dc7967fc39a ("staging: kpc2000: add initial set of Daktronics drivers")

regards,
dan carpenter

#3 lore raw
Quoted 5 lines · Dan Carpenter
Quoted 4 lines · Wei Yongjun

Fix to return a negative error code from the error handling case instead of 0, as done elsewhere in this function. Also removed var 'rv' since we can use 'err' instead.

Quoted 7 lines
Quoted 1 line

Also could you add a Fixes tag? This goes all the way back to the original commit:

Fixes 7dc7967fc39a ("staging: kpc2000: add initial set of Daktronics drivers")

Will fix both of your comments in next version, thanks.

Regards,
Wei Yongjun

#4 lore raw

PATCH v2 1/1 staging: kpc2000: fix error return code in kp2000_pcie_probe()

In reply to Wei Yongjun

Fix to return a negative error code from the error handling case instead of 0, as done elsewhere in this function. Also removed var 'rv' since we can use 'err' instead.

Fixes 7dc7967fc39a ("staging: kpc2000: add initial set of Daktronics drivers")

---
v1 -> v2: fix code aligns and add fixes

---
 drivers/staging/kpc2000/kpc2000/core.c | 9 ++++-----
 1 file changed, 4 insertions(+), 5 deletions(-)
drivers/staging/kpc2000/kpc2000/core.c +4 -5
index 7b00d7069e21..358d7b2f4ad1 100644
@@ -298,7 +298,6 @@ static int kp2000_pcie_probe(struct pci_dev *pdev,
 {
 	int err = 0;
 	struct kp2000_device *pcard;
-	int rv;
 	unsigned long reg_bar_phys_addr;
 	unsigned long reg_bar_phys_len;
 	unsigned long dma_bar_phys_addr;
@@ -445,11 +444,11 @@ static int kp2000_pcie_probe(struct pci_dev *pdev,
 	if (err < 0)
 		goto err_release_dma;
 
-	rv = request_irq(pcard->pdev->irq, kp2000_irq_handler, IRQF_SHARED,
-			 pcard->name, pcard);
-	if (rv) {
+	err = request_irq(pcard->pdev->irq, kp2000_irq_handler, IRQF_SHARED,
+			  pcard->name, pcard);
+	if (err) {
 		dev_err(&pcard->pdev->dev,
-			"%s: failed to request_irq: %d\n", __func__, rv);
+			"%s: failed to request_irq: %d\n", __func__, err);
 		goto err_disable_msi;
 	}