[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <b649e6ad-54c7-abfa-c9cd-45c0a99f56b1@linux.ibm.com>
Date: Tue, 11 Jan 2022 08:51:59 -0600
From: Eddie James <eajames@...ux.ibm.com>
To: Jiasheng Jiang <jiasheng@...as.ac.cn>, jk@...abs.org,
joel@....id.au, alistair@...ple.id.au
Cc: linux-fsi@...ts.ozlabs.org, linux-kernel@...r.kernel.org
Subject: Re: [PATCH] fsi: core: Check error number after calling
ida_simple_get
On 1/11/22 01:34, Jiasheng Jiang wrote:
> If allocation fails, the ida_simple_get() will return error number.
> So master->idx could be error number and be used in dev_set_name().
> Therefore, it should be better to check it and return error if fails,
> like the ida_simple_get() in __fsi_get_new_minor().
Reviewed-by: Eddie James <eajames@...ux.ibm.com>
>
> Fixes: 09aecfab93b8 ("drivers/fsi: Add fsi master definition")
> Signed-off-by: Jiasheng Jiang <jiasheng@...as.ac.cn>
> ---
> drivers/fsi/fsi-core.c | 3 +++
> 1 file changed, 3 insertions(+)
>
> diff --git a/drivers/fsi/fsi-core.c b/drivers/fsi/fsi-core.c
> index 59ddc9fd5bca..92e6eebd1851 100644
> --- a/drivers/fsi/fsi-core.c
> +++ b/drivers/fsi/fsi-core.c
> @@ -1309,6 +1309,9 @@ int fsi_master_register(struct fsi_master *master)
>
> mutex_init(&master->scan_lock);
> master->idx = ida_simple_get(&master_ida, 0, INT_MAX, GFP_KERNEL);
> + if (master->idx < 0)
> + return master->idx;
> +
> dev_set_name(&master->dev, "fsi%d", master->idx);
> master->dev.class = &fsi_master_class;
>
Powered by blists - more mailing lists