Commit 5cda6576 authored by Yang Yingliang's avatar Yang Yingliang Committed by Greg Kroah-Hartman
Browse files

usb: typec: anx7411: Fix return value check in anx7411_register_i2c_dummy_clients()



If i2c_new_dummy_device() fails, it never return NULL pointer, replace
NULL test with IS_ERR() to fix it.

Fixes: fe6d8a9c ("usb: typec: anx7411: Add Analogix PD ANX7411 support")
Signed-off-by: default avatarYang Yingliang <yangyingliang@huawei.com>
Link: https://lore.kernel.org/r/20220721071201.269344-2-yangyingliang@huawei.com


Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent 67fb0cc0
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -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;
		}
	}