diff options
author | Yang Yingliang <yangyingliang@huawei.com> | 2022-07-21 10:12:00 +0300 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2022-07-27 15:27:53 +0300 |
commit | 5cda657679f8fcb2896e4ac0aa8e231f12f9fb04 (patch) | |
tree | c01857d70480be01d0c40de8477648ce0b0e1cfc /drivers/usb/typec/anx7411.c | |
parent | 67fb0cc02f89049e532b008faa35818c82aa0d62 (diff) | |
download | linux-5cda657679f8fcb2896e4ac0aa8e231f12f9fb04.tar.xz |
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: fe6d8a9c8e64 ("usb: typec: anx7411: Add Analogix PD ANX7411 support")
Signed-off-by: Yang Yingliang <yangyingliang@huawei.com>
Link: https://lore.kernel.org/r/20220721071201.269344-2-yangyingliang@huawei.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'drivers/usb/typec/anx7411.c')
-rw-r--r-- | drivers/usb/typec/anx7411.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/drivers/usb/typec/anx7411.c b/drivers/usb/typec/anx7411.c index e16c2d511e8f..7692e26911b7 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; } } |