Skip to contentSkip to conversation

mcb: request_mem_region() returns NULL on error

PATCH Applied Dan Carpenter 2 participants 2 messages Jan 14, 2015 – Jan 15, 2015

Subsystems (2)

v1 of 2 Applied Latest is v2 →

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 mcb: request_mem_region() returns NULL on error

The code here is checking for IS_ERR() when request_mem_region() only returns NULL on error and never an ERR_PTR.

drivers/mcb/mcb-pci.c +2 -2
index 5e1bd5d..2d6524a 100644
@@ -56,9 +56,9 @@ static int mcb_pci_probe(struct pci_dev *pdev, const struct pci_device_id *id)
 
 	res = request_mem_region(priv->mapbase, CHAM_HEADER_SIZE,
 				 KBUILD_MODNAME);
-	if (IS_ERR(res)) {
+	if (!res) {
 		dev_err(&pdev->dev, "Failed to request PCI memory\n");
-		ret = PTR_ERR(res);
+		ret = -EBUSY;
 		goto err_start;
 	}
 
#1 lore raw
Quoted 11 lines · Dan Carpenter

The code here is checking for IS_ERR() when request_mem_region() only returns NULL on error and never an ERR_PTR.

drivers/mcb/mcb-pci.c +0 -0
index 5e1bd5d..2d6524a 100644
@@ -56,9 +56,9 @@ static int mcb_pci_probe(struct pci_dev *pdev, const struct pci_device_id *id)
 

drivers/mcb/mcb-pci.c static int mcb_pci_probe(struct pci_dev *pdev, const struct pci_device_id *id) · line 64

Quoted 10 lines
drivers/mcb/mcb-pci.c +2 -2
 	res = request_mem_region(priv->mapbase, CHAM_HEADER_SIZE,
 				 KBUILD_MODNAME);
-	if (IS_ERR(res)) {
+	if (!res) {
 		dev_err(&pdev->dev, "Failed to request PCI memory\n");
-		ret = PTR_ERR(res);
+		ret = -EBUSY;
 		goto err_start;
 	}
 

Applied to mcb-next, thanks.