extcon: realtek: add the error handler for nvmem_cell_read
authorStanley Chang <stanley_chang@realtek.com>
Mon, 16 Oct 2023 05:35:04 +0000 (13:35 +0800)
committerChanwoo Choi <cw00.choi@samsung.com>
Tue, 17 Oct 2023 08:38:57 +0000 (17:38 +0900)
commitb3edc3463d64bc469162138a6bec6913fbeef931
tree81854916205bc217673dc205aaffe01c05cbb6f1
parentda886ba844791d11c9d1526fddf8607eb0198243
extcon: realtek: add the error handler for nvmem_cell_read

There are following smatch warning:
drivers/extcon/extcon-rtk-type-c.c:905 __updated_type_c_parameter_by_efuse()
error: 'buf' dereferencing possible ERR_PTR()

The nvmem_cell_read may fail to read. So, driver must handle failure cases.

Link: https://lore.kernel.org/all/20231016053510.28881-1-stanley_chang@realtek.com/
Fixes: 8a590d7371f0 ("extcon: add Realtek DHC RTD SoC Type-C driver")
Reported-by: Dan Carpenter <dan.carpenter@linaro.org>
Closes: https://lore.kernel.org/all/a469dd51-f5d5-4e8f-ba36-6c7cea046fb8@moroto.mountain/
Signed-off-by: Stanley Chang <stanley_chang@realtek.com>
Signed-off-by: Chanwoo Choi <cw00.choi@samsung.com>
drivers/extcon/extcon-rtk-type-c.c