ice: fix return value check in ice_gnss.c
kthread_create_worker() and tty_alloc_driver() return ERR_PTR()
and never return NULL. The NULL test in the return value check
should be replaced with IS_ERR().
Fixes: 43113ff734 ("ice: add TTY for GNSS module for E810T device")
Reported-by: Hulk Robot <hulkci@huawei.com>
Signed-off-by: Yang Yingliang <yangyingliang@huawei.com>
Tested-by: Gurucharan <gurucharanx.g@intel.com> (A Contingent worker at Intel)
Signed-off-by: Tony Nguyen <anthony.l.nguyen@intel.com>
This commit is contained in:
parent
2bcd5b9f35
commit
2b1d0a242a
@ -125,7 +125,7 @@ static struct gnss_serial *ice_gnss_struct_init(struct ice_pf *pf)
|
|||||||
* writes.
|
* writes.
|
||||||
*/
|
*/
|
||||||
kworker = kthread_create_worker(0, "ice-gnss-%s", dev_name(dev));
|
kworker = kthread_create_worker(0, "ice-gnss-%s", dev_name(dev));
|
||||||
if (!kworker) {
|
if (IS_ERR(kworker)) {
|
||||||
kfree(gnss);
|
kfree(gnss);
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
@ -253,7 +253,7 @@ static struct tty_driver *ice_gnss_create_tty_driver(struct ice_pf *pf)
|
|||||||
int err;
|
int err;
|
||||||
|
|
||||||
tty_driver = tty_alloc_driver(1, TTY_DRIVER_REAL_RAW);
|
tty_driver = tty_alloc_driver(1, TTY_DRIVER_REAL_RAW);
|
||||||
if (!tty_driver) {
|
if (IS_ERR(tty_driver)) {
|
||||||
dev_err(ice_pf_to_dev(pf), "Failed to allocate memory for GNSS TTY\n");
|
dev_err(ice_pf_to_dev(pf), "Failed to allocate memory for GNSS TTY\n");
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user