linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Jens Axboe <axboe@kernel.dk>
To: Jia-Ju Bai <baijiaju1990@gmail.com>,
	josh.h.morris@us.ibm.com, pjk1939@linux.ibm.com
Cc: linux-block@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH] block: rsxx: fix error return code of rsxx_pci_probe()
Date: Tue, 9 Mar 2021 13:59:16 -0700	[thread overview]
Message-ID: <cf2dd66c-0e1e-944e-f4c5-542095f6c9d7@kernel.dk> (raw)
In-Reply-To: <20210308100554.10375-1-baijiaju1990@gmail.com>

On 3/8/21 3:05 AM, Jia-Ju Bai wrote:
> Some error handling segments of rsxx_pci_probe() do not return error code, 
> so add error code for these segments.
> 
> Fixes: 8722ff8cdbfa ("block: IBM RamSan 70/80 device driver")
> Reported-by: TOTE Robot <oslab@tsinghua.edu.cn>
> Signed-off-by: Jia-Ju Bai <baijiaju1990@gmail.com>
> ---
>  drivers/block/rsxx/core.c | 18 +++++++++++++++---
>  1 file changed, 15 insertions(+), 3 deletions(-)
> 
> diff --git a/drivers/block/rsxx/core.c b/drivers/block/rsxx/core.c
> index 63f549889f87..6b3b9b31a3e8 100644
> --- a/drivers/block/rsxx/core.c
> +++ b/drivers/block/rsxx/core.c
> @@ -760,13 +760,17 @@ static int rsxx_pci_probe(struct pci_dev *dev,
>  	pci_set_drvdata(dev, card);
>  
>  	st = ida_alloc(&rsxx_disk_ida, GFP_KERNEL);
> -	if (st < 0)
> +	if (st < 0) {
> +		st = -ENOMEM;
>  		goto failed_ida_get;
> +	}
>  	card->disk_id = st;
>  
>  	st = pci_enable_device(dev);
> -	if (st)
> +	if (st) {
> +		st = -EIO;
>  		goto failed_enable;
> +	}
>  
>  	pci_set_master(dev);

Maybe there are some valid parts to the patch, but the two above at
least make no sense - we're returning the error here as passed from
ida_alloc or pci_enable_device, why are you overriding them?

-- 
Jens Axboe


  reply	other threads:[~2021-03-09 21:00 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-03-08 10:05 [PATCH] block: rsxx: fix error return code of rsxx_pci_probe() Jia-Ju Bai
2021-03-09 20:59 ` Jens Axboe [this message]
2021-03-10  1:13   ` Jia-Ju Bai

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=cf2dd66c-0e1e-944e-f4c5-542095f6c9d7@kernel.dk \
    --to=axboe@kernel.dk \
    --cc=baijiaju1990@gmail.com \
    --cc=josh.h.morris@us.ibm.com \
    --cc=linux-block@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=pjk1939@linux.ibm.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).