[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <cf2dd66c-0e1e-944e-f4c5-542095f6c9d7@kernel.dk>
Date: Tue, 9 Mar 2021 13:59:16 -0700
From: Jens Axboe <axboe@...nel.dk>
To: Jia-Ju Bai <baijiaju1990@...il.com>, josh.h.morris@...ibm.com,
pjk1939@...ux.ibm.com
Cc: linux-block@...r.kernel.org, linux-kernel@...r.kernel.org
Subject: Re: [PATCH] block: rsxx: fix error return code of rsxx_pci_probe()
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@...nghua.edu.cn>
> Signed-off-by: Jia-Ju Bai <baijiaju1990@...il.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
Powered by blists - more mailing lists