Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

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>

authored by

Wei Yongjun and committed by
Vinod Koul
677c577e df2217ff

+2 -2
+2 -2
drivers/phy/sunplus/phy-sunplus-usb2.c
··· 92 92 otp_v = nvmem_cell_read(cell, &otp_l); 93 93 nvmem_cell_put(cell); 94 94 95 - if (otp_v) { 95 + if (!IS_ERR(otp_v)) { 96 96 set = *(otp_v + 1); 97 97 set = (set << (sizeof(char) * 8)) | *otp_v; 98 98 set = (set >> usbphy->disc_vol_addr_off) & J_DISC; 99 99 } 100 100 101 - if (!otp_v || set == 0) 101 + if (IS_ERR(otp_v) || set == 0) 102 102 set = OTP_DISC_LEVEL_DEFAULT; 103 103 104 104 val = readl(usbphy->phy_regs + CONFIG7);