mirror of
https://github.com/edk2-porting/linux-next.git
synced 2024-12-29 23:53:55 +08:00
block/rnbd: Fix an IS_ERR() vs NULL check in find_or_create_sess()
The alloc_sess() function returns error pointers, it never returns NULL.
Fixes: f7a7a5c228
("block/rnbd: client: main functionality")
Link: https://lore.kernel.org/r/20200519120347.GD42765@mwanda
Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
Reviewed-by: Jack Wang <jinpu.wang@cloud.ionos.com>
Signed-off-by: Jason Gunthorpe <jgg@mellanox.com>
This commit is contained in:
parent
6d1e7ba241
commit
47393fb57b
@ -923,13 +923,12 @@ rnbd_clt_session *find_or_create_sess(const char *sessname, bool *first)
|
||||
sess = __find_and_get_sess(sessname);
|
||||
if (!sess) {
|
||||
sess = alloc_sess(sessname);
|
||||
if (sess) {
|
||||
list_add(&sess->list, &sess_list);
|
||||
*first = true;
|
||||
} else {
|
||||
if (IS_ERR(sess)) {
|
||||
mutex_unlock(&sess_lock);
|
||||
return ERR_PTR(-ENOMEM);
|
||||
return sess;
|
||||
}
|
||||
list_add(&sess->list, &sess_list);
|
||||
*first = true;
|
||||
} else
|
||||
*first = false;
|
||||
mutex_unlock(&sess_lock);
|
||||
|
Loading…
Reference in New Issue
Block a user