kernel-janitors.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [patch] mcb: request_mem_region() returns NULL on error
@ 2015-01-14 21:08 Dan Carpenter
  2015-01-15  7:18 ` Johannes Thumshirn
  0 siblings, 1 reply; 2+ messages in thread
From: Dan Carpenter @ 2015-01-14 21:08 UTC (permalink / raw)
  To: Johannes Thumshirn
  Cc: linux-kernel, kernel-janitors, Greg Kroah-Hartman, Bjorn Helgaas

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

Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>

diff --git a/drivers/mcb/mcb-pci.c b/drivers/mcb/mcb-pci.c
index 5e1bd5d..2d6524a 100644
--- a/drivers/mcb/mcb-pci.c
+++ b/drivers/mcb/mcb-pci.c
@@ -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;
 	}
 

^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [patch] mcb: request_mem_region() returns NULL on error
  2015-01-14 21:08 [patch] mcb: request_mem_region() returns NULL on error Dan Carpenter
@ 2015-01-15  7:18 ` Johannes Thumshirn
  0 siblings, 0 replies; 2+ messages in thread
From: Johannes Thumshirn @ 2015-01-15  7:18 UTC (permalink / raw)
  To: Dan Carpenter
  Cc: Johannes Thumshirn, linux-kernel, kernel-janitors,
	Greg Kroah-Hartman, Bjorn Helgaas

On Thu, Jan 15, 2015 at 12:08:40AM +0300, Dan Carpenter wrote:
> The code here is checking for IS_ERR() when request_mem_region() only
> returns NULL on error and never an ERR_PTR.
> 
> Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
> 
> diff --git a/drivers/mcb/mcb-pci.c b/drivers/mcb/mcb-pci.c
> index 5e1bd5d..2d6524a 100644
> --- a/drivers/mcb/mcb-pci.c
> +++ b/drivers/mcb/mcb-pci.c
> @@ -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;
>  	}
>  

Applied to mcb-next, thanks.

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2015-01-15  7:18 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-01-14 21:08 [patch] mcb: request_mem_region() returns NULL on error Dan Carpenter
2015-01-15  7:18 ` Johannes Thumshirn

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).