From: Yang Yingliang <yangyingliang@huawei.com>
Date: Sat, 5 Mar 2022 17:04:30 +0800
Subject: ice: fix return value check in ice_gnss.c
Patch-mainline: v5.18-rc1
Git-commit: 2b1d0a242a0038f65e10d77261b7cbcb6bb5b18a
References: jsc#PED-376
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: 43113ff73453 ("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>
Acked-by: Thomas Bogendoerfer <tbogendoerfer@suse.de>
---
drivers/net/ethernet/intel/ice/ice_gnss.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
--- a/drivers/net/ethernet/intel/ice/ice_gnss.c
+++ b/drivers/net/ethernet/intel/ice/ice_gnss.c
@@ -125,7 +125,7 @@ static struct gnss_serial *ice_gnss_stru
* writes.
*/
kworker = kthread_create_worker(0, "ice-gnss-%s", dev_name(dev));
- if (!kworker) {
+ if (IS_ERR(kworker)) {
kfree(gnss);
return NULL;
}
@@ -253,7 +253,7 @@ static struct tty_driver *ice_gnss_creat
int err;
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");
return NULL;
}