Skip to contentSkip to conversation

fbdev: chipsfb: Fix error codes in chipsfb_pci_init()

PATCH Applied Dan Carpenter 2 participants 3 messages Feb 27, 2023 – Feb 28, 2023

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

PATCH v2 1/1 fbdev: chipsfb: Fix error codes in chipsfb_pci_init()

The error codes are not set on these error paths.

Fixes 145eed48de27 ("fbdev: Remove conflicting devices on PCI bus")

---
v2: I accidentally returned -EINVAL instead -ENODEV.
Add Thomas's Reviewed-by tag.

 drivers/video/fbdev/chipsfb.c | 14 ++++++++++----
 1 file changed, 10 insertions(+), 4 deletions(-)
drivers/video/fbdev/chipsfb.c +10 -4
index cc37ec3f8fc1..7799d52a651f 100644
@@ -358,16 +358,21 @@ static int chipsfb_pci_init(struct pci_dev *dp, const struct pci_device_id *ent)
 	if (rc)
 		return rc;
 
-	if (pci_enable_device(dp) < 0) {
+	rc = pci_enable_device(dp);
+	if (rc < 0) {
 		dev_err(&dp->dev, "Cannot enable PCI device\n");
 		goto err_out;
 	}
 
-	if ((dp->resource[0].flags & IORESOURCE_MEM) == 0)
+	if ((dp->resource[0].flags & IORESOURCE_MEM) == 0) {
+		rc = -ENODEV;
 		goto err_disable;
+	}
 	addr = pci_resource_start(dp, 0);
-	if (addr == 0)
+	if (addr == 0) {
+		rc = -ENODEV;
 		goto err_disable;
+	}
 
 	p = framebuffer_alloc(0, &dp->dev);
 	if (p == NULL) {
@@ -417,7 +422,8 @@ static int chipsfb_pci_init(struct pci_dev *dp, const struct pci_device_id *ent)
 
 	init_chips(p, addr);
 
-	if (register_framebuffer(p) < 0) {
+	rc = register_framebuffer(p);
+	if (rc < 0) {
 		dev_err(&dp->dev,"C&T 65550 framebuffer failed to register\n");
 		goto err_unmap;
 	}
Signature · 1 line
2.39.1
#1 lore raw

Hi

Am 27.02.23 um 11:33 schrieb Dan Carpenter:

Quoted 8 lines

The error codes are not set on these error paths.

Fixes 145eed48de27 ("fbdev: Remove conflicting devices on PCI bus")

---
v2: I accidentally returned -EINVAL instead -ENODEV.
Add Thomas's Reviewed-by tag.

Thanks a lot. Unless Helge takes it into the fbdev branch, I'll merge your patch through DRM trees within the next days.

Best regards
Thomas

Quoted 43 lines
  drivers/video/fbdev/chipsfb.c | 14 ++++++++++----
  1 file changed, 10 insertions(+), 4 deletions(-)
drivers/video/fbdev/chipsfb.c +10 -4
index cc37ec3f8fc1..7799d52a651f 100644
@@ -358,16 +358,21 @@ static int chipsfb_pci_init(struct pci_dev *dp, const struct pci_device_id *ent)
  	if (rc)
  		return rc;
 
-	if (pci_enable_device(dp) < 0) {
+	rc = pci_enable_device(dp);
+	if (rc < 0) {
  		dev_err(&dp->dev, "Cannot enable PCI device\n");
  		goto err_out;
  	}
 
-	if ((dp->resource[0].flags & IORESOURCE_MEM) == 0)
+	if ((dp->resource[0].flags & IORESOURCE_MEM) == 0) {
+		rc = -ENODEV;
  		goto err_disable;
+	}
  	addr = pci_resource_start(dp, 0);
-	if (addr == 0)
+	if (addr == 0) {
+		rc = -ENODEV;
  		goto err_disable;
+	}
 
  	p = framebuffer_alloc(0, &dp->dev);
  	if (p == NULL) {
@@ -417,7 +422,8 @@ static int chipsfb_pci_init(struct pci_dev *dp, const struct pci_device_id *ent)
 
  	init_chips(p, addr);
 
-	if (register_framebuffer(p) < 0) {
+	rc = register_framebuffer(p);
+	if (rc < 0) {
  		dev_err(&dp->dev,"C&T 65550 framebuffer failed to register\n");
  		goto err_unmap;
  	}
Signature · 6 lines
Thomas Zimmermann
Graphics Driver Developer
SUSE Software Solutions Germany GmbH
Maxfeldstr. 5, 90409 Nürnberg, Germany
(HRB 36809, AG Nürnberg)
Geschäftsführer: Ivo Totev
#2 lore raw
In reply to Dan Carpenter

Merged into drm-misc-fixes.

Am 27.02.23 um 11:33 schrieb Dan Carpenter:

Quoted 51 lines

The error codes are not set on these error paths.

Fixes 145eed48de27 ("fbdev: Remove conflicting devices on PCI bus")

---
v2: I accidentally returned -EINVAL instead -ENODEV.
Add Thomas's Reviewed-by tag.

  drivers/video/fbdev/chipsfb.c | 14 ++++++++++----
  1 file changed, 10 insertions(+), 4 deletions(-)
drivers/video/fbdev/chipsfb.c +10 -4
index cc37ec3f8fc1..7799d52a651f 100644
@@ -358,16 +358,21 @@ static int chipsfb_pci_init(struct pci_dev *dp, const struct pci_device_id *ent)
  	if (rc)
  		return rc;
 
-	if (pci_enable_device(dp) < 0) {
+	rc = pci_enable_device(dp);
+	if (rc < 0) {
  		dev_err(&dp->dev, "Cannot enable PCI device\n");
  		goto err_out;
  	}
 
-	if ((dp->resource[0].flags & IORESOURCE_MEM) == 0)
+	if ((dp->resource[0].flags & IORESOURCE_MEM) == 0) {
+		rc = -ENODEV;
  		goto err_disable;
+	}
  	addr = pci_resource_start(dp, 0);
-	if (addr == 0)
+	if (addr == 0) {
+		rc = -ENODEV;
  		goto err_disable;
+	}
 
  	p = framebuffer_alloc(0, &dp->dev);
  	if (p == NULL) {
@@ -417,7 +422,8 @@ static int chipsfb_pci_init(struct pci_dev *dp, const struct pci_device_id *ent)
 
  	init_chips(p, addr);
 
-	if (register_framebuffer(p) < 0) {
+	rc = register_framebuffer(p);
+	if (rc < 0) {
  		dev_err(&dp->dev,"C&T 65550 framebuffer failed to register\n");
  		goto err_unmap;
  	}
Signature · 6 lines
Thomas Zimmermann
Graphics Driver Developer
SUSE Software Solutions Germany GmbH
Maxfeldstr. 5, 90409 Nürnberg, Germany
(HRB 36809, AG Nürnberg)
Geschäftsführer: Ivo Totev