diff mbox series

[net-next] ice: gnss: fix a NULL vs IS_ERR() check

Message ID 20220307141746.GD18867@kili
State Not Applicable
Headers show
Series [net-next] ice: gnss: fix a NULL vs IS_ERR() check | expand

Commit Message

Dan Carpenter March 7, 2022, 2:17 p.m. UTC
The tty_alloc_driver() function returns error pointers, it never returns
NULL.

Fixes: 43113ff73453 ("ice: add TTY for GNSS module for E810T device")
Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
---
 drivers/net/ethernet/intel/ice/ice_gnss.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Tony Nguyen March 8, 2022, 5:34 p.m. UTC | #1
Hi Dan,

On 3/7/2022 6:17 AM, Dan Carpenter wrote:
> The tty_alloc_driver() function returns error pointers, it never returns
> NULL.

We already have a fix patch that also addresses another of the same issue.

https://patchwork.ozlabs.org/project/intel-wired-lan/patch/20220305090430.3078757-1-yangyingliang@huawei.com/

Thanks,

Tony

> Fixes: 43113ff73453 ("ice: add TTY for GNSS module for E810T device")
> Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
diff mbox series

Patch

diff --git a/drivers/net/ethernet/intel/ice/ice_gnss.c b/drivers/net/ethernet/intel/ice/ice_gnss.c
index 755e1580f368..333c085a228a 100644
--- a/drivers/net/ethernet/intel/ice/ice_gnss.c
+++ b/drivers/net/ethernet/intel/ice/ice_gnss.c
@@ -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;
 	}