diff options
author | Wei Yongjun <weiyongjun1@huawei.com> | 2022-09-09 12:47:09 +0300 |
---|---|---|
committer | Vinod Koul <vkoul@kernel.org> | 2022-09-13 18:28:33 +0300 |
commit | 677c577e1762afaaee452ababe1c070c24c647c0 (patch) | |
tree | e3990b3f5a62ccff9a41d4b43689690e8838a849 /drivers/phy/sunplus | |
parent | df2217ff17a8207295e77ec12a858545633bf4cb (diff) | |
download | linux-677c577e1762afaaee452ababe1c070c24c647c0.tar.xz |
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: 99d9ccd97385 ("phy: usb: Add USB2.0 phy driver for Sunplus SP7021")
Signed-off-by: Wei Yongjun <weiyongjun1@huawei.com>
Link: https://lore.kernel.org/r/20220909094709.1790970-1-weiyongjun@huaweicloud.com
Signed-off-by: Vinod Koul <vkoul@kernel.org>
Diffstat (limited to 'drivers/phy/sunplus')
-rw-r--r-- | drivers/phy/sunplus/phy-sunplus-usb2.c | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/drivers/phy/sunplus/phy-sunplus-usb2.c b/drivers/phy/sunplus/phy-sunplus-usb2.c index 5269968b3060..b932087c55b2 100644 --- a/drivers/phy/sunplus/phy-sunplus-usb2.c +++ b/drivers/phy/sunplus/phy-sunplus-usb2.c @@ -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); |