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 <os...@tsinghua.edu.cn>
> Signed-off-by: Jia-Ju Bai <baijiaju1...@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 via email to