summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--drivers/phy/realtek/phy-rtk-usb2.c14
-rw-r--r--drivers/phy/realtek/phy-rtk-usb3.c7
2 files changed, 12 insertions, 9 deletions
diff --git a/drivers/phy/realtek/phy-rtk-usb2.c b/drivers/phy/realtek/phy-rtk-usb2.c
index ed47a1ce5d9c..5e7ee060b404 100644
--- a/drivers/phy/realtek/phy-rtk-usb2.c
+++ b/drivers/phy/realtek/phy-rtk-usb2.c
@@ -898,9 +898,10 @@ static int get_phy_data_by_efuse(struct rtk_phy *rtk_phy,
size_t buf_size;
buf = nvmem_cell_read(cell, &buf_size);
- value = buf[0] & phy_cfg->dc_driving_mask;
-
- kfree(buf);
+ if (!IS_ERR(buf)) {
+ value = buf[0] & phy_cfg->dc_driving_mask;
+ kfree(buf);
+ }
nvmem_cell_put(cell);
}
@@ -939,9 +940,10 @@ static int get_phy_data_by_efuse(struct rtk_phy *rtk_phy,
size_t buf_size;
buf = nvmem_cell_read(cell, &buf_size);
- value = buf[0] & phy_cfg->dc_disconnect_mask;
-
- kfree(buf);
+ if (!IS_ERR(buf)) {
+ value = buf[0] & phy_cfg->dc_disconnect_mask;
+ kfree(buf);
+ }
nvmem_cell_put(cell);
}
diff --git a/drivers/phy/realtek/phy-rtk-usb3.c b/drivers/phy/realtek/phy-rtk-usb3.c
index 6050f1ef4f6b..7881f908aade 100644
--- a/drivers/phy/realtek/phy-rtk-usb3.c
+++ b/drivers/phy/realtek/phy-rtk-usb3.c
@@ -457,9 +457,10 @@ static int get_phy_data_by_efuse(struct rtk_phy *rtk_phy,
size_t buf_size;
buf = nvmem_cell_read(cell, &buf_size);
- value = buf[0] & USB_U3_TX_LFPS_SWING_TRIM_MASK;
-
- kfree(buf);
+ if (!IS_ERR(buf)) {
+ value = buf[0] & USB_U3_TX_LFPS_SWING_TRIM_MASK;
+ kfree(buf);
+ }
nvmem_cell_put(cell);
}