Commit 3ab4ce2d authored by Wei Yongjun's avatar Wei Yongjun Committed by Wolfram Sang

i2c: designware: Fix return value check in navi_amd_register_client()

In case of error, the function i2c_new_client_device() returns
ERR_PTR() and never returns NULL. The NULL test in the return
value check should be replaced with IS_ERR().

Fixes: 17631e8c ("i2c: designware: Add driver support for AMD NAVI GPU")
Reported-by: default avatarHulk Robot <hulkci@huawei.com>
Signed-off-by: default avatarWei Yongjun <weiyongjun1@huawei.com>
Acked-by: default avatarJarkko Nikula <jarkko.nikula@linux.intel.com>
Signed-off-by: default avatarWolfram Sang <wsa@kernel.org>
parent 010e32ab
...@@ -132,8 +132,8 @@ static int navi_amd_register_client(struct dw_i2c_dev *dev) ...@@ -132,8 +132,8 @@ static int navi_amd_register_client(struct dw_i2c_dev *dev)
info.irq = dev->irq; info.irq = dev->irq;
dev->slave = i2c_new_client_device(&dev->adapter, &info); dev->slave = i2c_new_client_device(&dev->adapter, &info);
if (!dev->slave) if (IS_ERR(dev->slave))
return -ENODEV; return PTR_ERR(dev->slave);
return 0; return 0;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment