diff mbox

[1/1] isdn: hisax: set error code on failure

Message ID 1480828511-4251-1-git-send-email-bianpan201603@163.com
State Changes Requested, archived
Delegated to: David Miller
Headers show

Commit Message

Pan Bian Dec. 4, 2016, 5:15 a.m. UTC
From: Pan Bian <bianpan2016@163.com>

In function hfc4s8s_probe(), the value of return variable err should be
negative on failures. However, when the call to request_region() returns
NULL, the value of err is 0. This patch fixes the bug, assiging
"-ENOMEM" to err on the path that request_region() fails.

Bugzilla: https://bugzilla.kernel.org/show_bug.cgi?id=188931

Signed-off-by: Pan Bian <bianpan2016@163.com>
---
 drivers/isdn/hisax/hfc4s8s_l1.c | 1 +
 1 file changed, 1 insertion(+)

Comments

Sergei Shtylyov Dec. 4, 2016, 10:14 a.m. UTC | #1
Hello.

On 12/4/2016 8:15 AM, Pan Bian wrote:

> From: Pan Bian <bianpan2016@163.com>
>
> In function hfc4s8s_probe(), the value of return variable err should be
> negative on failures. However, when the call to request_region() returns
> NULL, the value of err is 0. This patch fixes the bug, assiging
> "-ENOMEM" to err on the path that request_region() fails.
>
> Bugzilla: https://bugzilla.kernel.org/show_bug.cgi?id=188931
>
> Signed-off-by: Pan Bian <bianpan2016@163.com>
> ---
>  drivers/isdn/hisax/hfc4s8s_l1.c | 1 +
>  1 file changed, 1 insertion(+)
>
> diff --git a/drivers/isdn/hisax/hfc4s8s_l1.c b/drivers/isdn/hisax/hfc4s8s_l1.c
> index 9600cd7..3172cee 100644
> --- a/drivers/isdn/hisax/hfc4s8s_l1.c
> +++ b/drivers/isdn/hisax/hfc4s8s_l1.c
> @@ -1499,6 +1499,7 @@ struct hfc4s8s_l1 {
>  		printk(KERN_INFO
>  		       "HFC-4S/8S: failed to request address space at 0x%04x\n",
>  		       hw->iobase);
> +		err = -ENOMEM;

    -EBUSY fits request_region() better.

[..]

MBR, Sergei
diff mbox

Patch

diff --git a/drivers/isdn/hisax/hfc4s8s_l1.c b/drivers/isdn/hisax/hfc4s8s_l1.c
index 9600cd7..3172cee 100644
--- a/drivers/isdn/hisax/hfc4s8s_l1.c
+++ b/drivers/isdn/hisax/hfc4s8s_l1.c
@@ -1499,6 +1499,7 @@  struct hfc4s8s_l1 {
 		printk(KERN_INFO
 		       "HFC-4S/8S: failed to request address space at 0x%04x\n",
 		       hw->iobase);
+		err = -ENOMEM;
 		goto out;
 	}