Skip to content

Commit

Permalink
usb: typec: anx7411: Fix return value check in anx7411_register_i2c_d…
Browse files Browse the repository at this point in the history
…ummy_clients()

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

Fixes: fe6d8a9 ("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>
  • Loading branch information
Yang Yingliang authored and Greg Kroah-Hartman committed Jul 27, 2022
1 parent 67fb0cc commit 5cda657
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion drivers/usb/typec/anx7411.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
}
Expand Down

0 comments on commit 5cda657

Please sign in to comment.