linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH -next] ice: fix return value check in ice_gnss.c
@ 2022-03-05  9:04 Yang Yingliang
  2022-03-11  6:34 ` G, GurucharanX
  0 siblings, 1 reply; 2+ messages in thread
From: Yang Yingliang @ 2022-03-05  9:04 UTC (permalink / raw)
  To: linux-kernel, intel-wired-lan
  Cc: netdev, kuba, davem, anthony.l.nguyen, karol.kolacinski

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>
---
 drivers/net/ethernet/intel/ice/ice_gnss.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/net/ethernet/intel/ice/ice_gnss.c b/drivers/net/ethernet/intel/ice/ice_gnss.c
index 755e1580f368..35579cf4283f 100644
--- 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_struct_init(struct ice_pf *pf)
 	 * 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_create_tty_driver(struct ice_pf *pf)
 	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;
 	}
-- 
2.25.1


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* RE: [PATCH -next] ice: fix return value check in ice_gnss.c
  2022-03-05  9:04 [PATCH -next] ice: fix return value check in ice_gnss.c Yang Yingliang
@ 2022-03-11  6:34 ` G, GurucharanX
  0 siblings, 0 replies; 2+ messages in thread
From: G, GurucharanX @ 2022-03-11  6:34 UTC (permalink / raw)
  To: Yang Yingliang, linux-kernel, intel-wired-lan
  Cc: netdev, kuba, davem, Nguyen, Anthony L, Kolacinski, Karol



> -----Original Message-----
> From: Yang Yingliang <yangyingliang@huawei.com>
> Sent: Saturday, March 5, 2022 2:35 PM
> To: linux-kernel@vger.kernel.org; intel-wired-lan@lists.osuosl.org
> Cc: netdev@vger.kernel.org; kuba@kernel.org; davem@davemloft.net;
> Nguyen, Anthony L <anthony.l.nguyen@intel.com>; Kolacinski, Karol
> <karol.kolacinski@intel.com>
> Subject: [PATCH -next] 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: 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>
> ---
>  drivers/net/ethernet/intel/ice/ice_gnss.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
> 

Tested-by: Gurucharan <gurucharanx.g@intel.com> (A Contingent worker at Intel)

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2022-03-11  6:35 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-03-05  9:04 [PATCH -next] ice: fix return value check in ice_gnss.c Yang Yingliang
2022-03-11  6:34 ` G, GurucharanX

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).