Re: [PATCH 2/7] staging: sm750fb: remove needless goto statements and lables

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Sun, Nov 01, 2015 at 10:55:48AM +0200, Mike Rapoport wrote:
> In lynxfb_pci_probe return error immediately in cases no cleanup is
> required.
> 
> Signed-off-by: Mike Rapoport <mike.rapoport@xxxxxxxxx>
> ---

NACK.
It should be:

diff --git a/drivers/staging/sm750fb/sm750.c b/drivers/staging/sm750fb/sm750.c
index c78421b..3713a8d 100644
--- a/drivers/staging/sm750fb/sm750.c
+++ b/drivers/staging/sm750fb/sm750.c
@@ -1010,7 +1010,7 @@ static int lynxfb_pci_probe(struct pci_dev *pdev,
 	/* enable device */
 	if (pci_enable_device(pdev)) {
 		pr_err("can not enable device.\n");
-		goto err_enable;
+		return -ENODEV;
 	}
 
 	sm750_dev = kzalloc(sizeof(*sm750_dev), GFP_KERNEL);
@@ -1132,7 +1132,7 @@ err_info0_alloc:
 err_map:
 	kfree(sm750_dev);
 err_share:
-err_enable:
+	pci_disable_device(pdev);
 	return -ENODEV;
 }


Ahh, well, this is also not entirely correct. We are returning -ENODEV
in all cases. The actual error code should be returned.

regards
sudip
_______________________________________________
devel mailing list
devel@xxxxxxxxxxxxxxxxxxxxxx
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel



[Index of Archives]     [Linux Driver Backports]     [DMA Engine]     [Linux GPIO]     [Linux SPI]     [Video for Linux]     [Linux USB Devel]     [Linux Coverity]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [Yosemite Backpacking]
  Powered by Linux