diff mbox series

[-next,2/3] usb: typec: anx7411: Fix return value check in anx7411_register_i2c_dummy_clients()

Message ID 20220721071201.269344-2-yangyingliang@huawei.com
State New
Headers show
Series [-next,1/3] usb: typec: anx7411: Fix wrong pointer passed to PTR_ERR() | expand

Commit Message

Yang Yingliang July 21, 2022, 7:12 a.m. UTC
If i2c_new_dummy_device() fails, it never return NULL pointer, replace
NULL test with IS_ERR() to fix it.

Fixes: fe6d8a9c8e64 ("usb: typec: anx7411: Add Analogix PD ANX7411 support")
Signed-off-by: Yang Yingliang <yangyingliang@huawei.com>
---
 drivers/usb/typec/anx7411.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
diff mbox series

Patch

diff --git a/drivers/usb/typec/anx7411.c b/drivers/usb/typec/anx7411.c
index 1ffab17a9b17..4816f5d24ac3 100644
--- a/drivers/usb/typec/anx7411.c
+++ b/drivers/usb/typec/anx7411.c
@@ -999,7 +999,7 @@  static int anx7411_register_i2c_dummy_clients(struct anx7411_data *ctx,
 			spi_addr = anx7411_i2c_addr[i].spi_address >> 1;
 			ctx->spi_client = i2c_new_dummy_device(client->adapter,
 							       spi_addr);
-			if (ctx->spi_client)
+			if (!IS_ERR(ctx->spi_client))
 				return 0;
 		}
 	}