Commit 677c577e authored by Wei Yongjun's avatar Wei Yongjun Committed by Vinod Koul

phy: usb: sunplus: Fix return value check in update_disc_vol()

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

Fixes: 99d9ccd9 ("phy: usb: Add USB2.0 phy driver for Sunplus SP7021")
Signed-off-by: default avatarWei Yongjun <weiyongjun1@huawei.com>
Link: https://lore.kernel.org/r/20220909094709.1790970-1-weiyongjun@huaweicloud.comSigned-off-by: default avatarVinod Koul <vkoul@kernel.org>
parent df2217ff
......@@ -92,13 +92,13 @@ static int update_disc_vol(struct sp_usbphy *usbphy)
otp_v = nvmem_cell_read(cell, &otp_l);
nvmem_cell_put(cell);
if (otp_v) {
if (!IS_ERR(otp_v)) {
set = *(otp_v + 1);
set = (set << (sizeof(char) * 8)) | *otp_v;
set = (set >> usbphy->disc_vol_addr_off) & J_DISC;
}
if (!otp_v || set == 0)
if (IS_ERR(otp_v) || set == 0)
set = OTP_DISC_LEVEL_DEFAULT;
val = readl(usbphy->phy_regs + CONFIG7);
......
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