Skip to content

Commit e747fa4

Browse files
rubycommigorpecovnik
authored andcommitted
rk3528-10-phy-rockchip-inno-usb2: split IS_ERR(rphy->grf) per-branch
Address CodeRabbit's review feedback on PR #9785: the consolidated IS_ERR(rphy->grf) check at the end of both branches printed "failed to locate usbgrf" even when the parent-syscon lookup in the else branch failed (which has nothing to do with the usbgrf phandle). Split the check per-branch so the diagnostic only fires when the lookup it refers to actually failed; the else branch now fails silently before the phy_base alias, matching upstream Linux's existing per-branch error-handling convention for this driver. No behavioral change beyond more accurate error logging on the older-SoC path. Applied identically to rockchip64-6.18, 7.0, 7.1. Signed-off-by: Shlomi Marco <s.marco@rubycomm.com>
1 parent 3332b71 commit e747fa4

3 files changed

Lines changed: 36 additions & 30 deletions

File tree

patch/kernel/archive/rockchip64-6.18/rk3528-10-phy-rockchip-inno-usb2-Add-support-for-RK3528.patch

Lines changed: 12 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -21,8 +21,8 @@ next-20250910-rk3528 branch.
2121

2222
Signed-off-by: Shlomi Marco <s.marco@rubycomm.com>
2323
---
24-
drivers/phy/rockchip/phy-rockchip-inno-usb2.c | 162 ++++++++--
25-
1 file changed, 129 insertions(+), 33 deletions(-)
24+
drivers/phy/rockchip/phy-rockchip-inno-usb2.c | 164 ++++++++--
25+
1 file changed, 131 insertions(+), 33 deletions(-)
2626

2727
diff --git a/drivers/phy/rockchip/phy-rockchip-inno-usb2.c b/drivers/phy/rockchip/phy-rockchip-inno-usb2.c
2828
index 111111111111..222222222222 100644
@@ -141,7 +141,7 @@ index 111111111111..222222222222 100644
141141
}
142142

143143
static unsigned long
144-
@@ -1360,27 +1381,20 @@ static int rockchip_usb2phy_probe(struct platform_device *pdev)
144+
@@ -1360,27 +1381,22 @@ static int rockchip_usb2phy_probe(struct platform_device *pdev)
145145
if (!rphy)
146146
return -ENOMEM;
147147

@@ -157,6 +157,10 @@ index 111111111111..222222222222 100644
157157
+ if (IS_ERR(rphy->phy_base))
158158
+ return PTR_ERR(rphy->phy_base);
159159
+ rphy->grf = syscon_regmap_lookup_by_phandle(np, "rockchip,usbgrf");
160+
+ if (IS_ERR(rphy->grf)) {
161+
+ dev_err(dev, "failed to locate usbgrf\n");
162+
+ return PTR_ERR(rphy->grf);
163+
+ }
160164
} else {
161165
rphy->grf = syscon_node_to_regmap(dev->parent->of_node);
162166
- if (IS_ERR(rphy->grf))
@@ -171,16 +175,14 @@ index 111111111111..222222222222 100644
171175
- return PTR_ERR(rphy->usbgrf);
172176
- } else {
173177
- rphy->usbgrf = NULL;
178+
+ if (IS_ERR(rphy->grf))
179+
+ return PTR_ERR(rphy->grf);
174180
+ rphy->phy_base = rphy->grf;
175181
}
176-
+ if (IS_ERR(rphy->grf)) {
177-
+ dev_err(dev, "failed to locate usbgrf\n");
178-
+ return PTR_ERR(rphy->grf);
179-
+ }
180182

181183
if (of_property_read_u32_index(np, "reg", 0, &reg)) {
182184
dev_err(dev, "the reg property is not assigned in %pOFn node\n", np);
183-
@@ -1521,6 +1535,36 @@ static int rk3128_usb2phy_tuning(struct rockchip_usb2phy *rphy)
185+
@@ -1521,6 +1537,36 @@ static int rk3128_usb2phy_tuning(struct rockchip_usb2phy *rphy)
184186
BIT(2) << BIT_WRITEABLE_SHIFT | 0);
185187
}
186188

@@ -217,7 +219,7 @@ index 111111111111..222222222222 100644
217219
static int rk3576_usb2phy_tuning(struct rockchip_usb2phy *rphy)
218220
{
219221
int ret;
220-
@@ -1934,6 +1978,57 @@ static const struct rockchip_usb2phy_cfg rk3399_phy_cfgs[] = {
222+
@@ -1934,6 +1980,57 @@ static const struct rockchip_usb2phy_cfg rk3399_phy_cfgs[] = {
221223
{ /* sentinel */ }
222224
};
223225

@@ -275,7 +277,7 @@ index 111111111111..222222222222 100644
275277
static const struct rockchip_usb2phy_cfg rk3562_phy_cfgs[] = {
276278
{
277279
.reg = 0xff740000,
278-
@@ -2301,6 +2396,7 @@ static const struct of_device_id rockchip_usb2phy_dt_match[] = {
280+
@@ -2301,6 +2398,7 @@ static const struct of_device_id rockchip_usb2phy_dt_match[] = {
279281
{ .compatible = "rockchip,rk3328-usb2phy", .data = &rk3328_phy_cfgs },
280282
{ .compatible = "rockchip,rk3366-usb2phy", .data = &rk3366_phy_cfgs },
281283
{ .compatible = "rockchip,rk3399-usb2phy", .data = &rk3399_phy_cfgs },

patch/kernel/archive/rockchip64-7.0/rk3528-10-phy-rockchip-inno-usb2-Add-support-for-RK3528.patch

Lines changed: 12 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -21,8 +21,8 @@ next-20250910-rk3528 branch.
2121

2222
Signed-off-by: Shlomi Marco <s.marco@rubycomm.com>
2323
---
24-
drivers/phy/rockchip/phy-rockchip-inno-usb2.c | 162 ++++++++--
25-
1 file changed, 129 insertions(+), 33 deletions(-)
24+
drivers/phy/rockchip/phy-rockchip-inno-usb2.c | 164 ++++++++--
25+
1 file changed, 131 insertions(+), 33 deletions(-)
2626

2727
diff --git a/drivers/phy/rockchip/phy-rockchip-inno-usb2.c b/drivers/phy/rockchip/phy-rockchip-inno-usb2.c
2828
index 111111111111..222222222222 100644
@@ -141,7 +141,7 @@ index 111111111111..222222222222 100644
141141
}
142142

143143
static unsigned long
144-
@@ -1360,27 +1381,20 @@ static int rockchip_usb2phy_probe(struct platform_device *pdev)
144+
@@ -1360,27 +1381,22 @@ static int rockchip_usb2phy_probe(struct platform_device *pdev)
145145
if (!rphy)
146146
return -ENOMEM;
147147

@@ -157,6 +157,10 @@ index 111111111111..222222222222 100644
157157
+ if (IS_ERR(rphy->phy_base))
158158
+ return PTR_ERR(rphy->phy_base);
159159
+ rphy->grf = syscon_regmap_lookup_by_phandle(np, "rockchip,usbgrf");
160+
+ if (IS_ERR(rphy->grf)) {
161+
+ dev_err(dev, "failed to locate usbgrf\n");
162+
+ return PTR_ERR(rphy->grf);
163+
+ }
160164
} else {
161165
rphy->grf = syscon_node_to_regmap(dev->parent->of_node);
162166
- if (IS_ERR(rphy->grf))
@@ -171,16 +175,14 @@ index 111111111111..222222222222 100644
171175
- return PTR_ERR(rphy->usbgrf);
172176
- } else {
173177
- rphy->usbgrf = NULL;
178+
+ if (IS_ERR(rphy->grf))
179+
+ return PTR_ERR(rphy->grf);
174180
+ rphy->phy_base = rphy->grf;
175181
}
176-
+ if (IS_ERR(rphy->grf)) {
177-
+ dev_err(dev, "failed to locate usbgrf\n");
178-
+ return PTR_ERR(rphy->grf);
179-
+ }
180182

181183
if (of_property_read_u32_index(np, "reg", 0, &reg)) {
182184
dev_err(dev, "the reg property is not assigned in %pOFn node\n", np);
183-
@@ -1521,6 +1535,36 @@ static int rk3128_usb2phy_tuning(struct rockchip_usb2phy *rphy)
185+
@@ -1521,6 +1537,36 @@ static int rk3128_usb2phy_tuning(struct rockchip_usb2phy *rphy)
184186
BIT(2) << BIT_WRITEABLE_SHIFT | 0);
185187
}
186188

@@ -217,7 +219,7 @@ index 111111111111..222222222222 100644
217219
static int rk3576_usb2phy_tuning(struct rockchip_usb2phy *rphy)
218220
{
219221
int ret;
220-
@@ -1934,6 +1978,57 @@ static const struct rockchip_usb2phy_cfg rk3399_phy_cfgs[] = {
222+
@@ -1934,6 +1980,57 @@ static const struct rockchip_usb2phy_cfg rk3399_phy_cfgs[] = {
221223
{ /* sentinel */ }
222224
};
223225

@@ -275,7 +277,7 @@ index 111111111111..222222222222 100644
275277
static const struct rockchip_usb2phy_cfg rk3562_phy_cfgs[] = {
276278
{
277279
.reg = 0xff740000,
278-
@@ -2301,6 +2396,7 @@ static const struct of_device_id rockchip_usb2phy_dt_match[] = {
280+
@@ -2301,6 +2398,7 @@ static const struct of_device_id rockchip_usb2phy_dt_match[] = {
279281
{ .compatible = "rockchip,rk3328-usb2phy", .data = &rk3328_phy_cfgs },
280282
{ .compatible = "rockchip,rk3366-usb2phy", .data = &rk3366_phy_cfgs },
281283
{ .compatible = "rockchip,rk3399-usb2phy", .data = &rk3399_phy_cfgs },

patch/kernel/archive/rockchip64-7.1/rk3528-10-phy-rockchip-inno-usb2-Add-support-for-RK3528.patch

Lines changed: 12 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -21,8 +21,8 @@ next-20250910-rk3528 branch.
2121

2222
Signed-off-by: Shlomi Marco <s.marco@rubycomm.com>
2323
---
24-
drivers/phy/rockchip/phy-rockchip-inno-usb2.c | 162 ++++++++--
25-
1 file changed, 129 insertions(+), 33 deletions(-)
24+
drivers/phy/rockchip/phy-rockchip-inno-usb2.c | 164 ++++++++--
25+
1 file changed, 131 insertions(+), 33 deletions(-)
2626

2727
diff --git a/drivers/phy/rockchip/phy-rockchip-inno-usb2.c b/drivers/phy/rockchip/phy-rockchip-inno-usb2.c
2828
index 111111111111..222222222222 100644
@@ -141,7 +141,7 @@ index 111111111111..222222222222 100644
141141
}
142142

143143
static unsigned long
144-
@@ -1360,27 +1381,20 @@ static int rockchip_usb2phy_probe(struct platform_device *pdev)
144+
@@ -1360,27 +1381,22 @@ static int rockchip_usb2phy_probe(struct platform_device *pdev)
145145
if (!rphy)
146146
return -ENOMEM;
147147

@@ -157,6 +157,10 @@ index 111111111111..222222222222 100644
157157
+ if (IS_ERR(rphy->phy_base))
158158
+ return PTR_ERR(rphy->phy_base);
159159
+ rphy->grf = syscon_regmap_lookup_by_phandle(np, "rockchip,usbgrf");
160+
+ if (IS_ERR(rphy->grf)) {
161+
+ dev_err(dev, "failed to locate usbgrf\n");
162+
+ return PTR_ERR(rphy->grf);
163+
+ }
160164
} else {
161165
rphy->grf = syscon_node_to_regmap(dev->parent->of_node);
162166
- if (IS_ERR(rphy->grf))
@@ -171,16 +175,14 @@ index 111111111111..222222222222 100644
171175
- return PTR_ERR(rphy->usbgrf);
172176
- } else {
173177
- rphy->usbgrf = NULL;
178+
+ if (IS_ERR(rphy->grf))
179+
+ return PTR_ERR(rphy->grf);
174180
+ rphy->phy_base = rphy->grf;
175181
}
176-
+ if (IS_ERR(rphy->grf)) {
177-
+ dev_err(dev, "failed to locate usbgrf\n");
178-
+ return PTR_ERR(rphy->grf);
179-
+ }
180182

181183
if (of_property_read_u32_index(np, "reg", 0, &reg)) {
182184
dev_err(dev, "the reg property is not assigned in %pOFn node\n", np);
183-
@@ -1521,6 +1535,36 @@ static int rk3128_usb2phy_tuning(struct rockchip_usb2phy *rphy)
185+
@@ -1521,6 +1537,36 @@ static int rk3128_usb2phy_tuning(struct rockchip_usb2phy *rphy)
184186
BIT(2) << BIT_WRITEABLE_SHIFT | 0);
185187
}
186188

@@ -217,7 +219,7 @@ index 111111111111..222222222222 100644
217219
static int rk3576_usb2phy_tuning(struct rockchip_usb2phy *rphy)
218220
{
219221
int ret;
220-
@@ -1934,6 +1978,57 @@ static const struct rockchip_usb2phy_cfg rk3399_phy_cfgs[] = {
222+
@@ -1934,6 +1980,57 @@ static const struct rockchip_usb2phy_cfg rk3399_phy_cfgs[] = {
221223
{ /* sentinel */ }
222224
};
223225

@@ -275,7 +277,7 @@ index 111111111111..222222222222 100644
275277
static const struct rockchip_usb2phy_cfg rk3562_phy_cfgs[] = {
276278
{
277279
.reg = 0xff740000,
278-
@@ -2301,6 +2396,7 @@ static const struct of_device_id rockchip_usb2phy_dt_match[] = {
280+
@@ -2301,6 +2398,7 @@ static const struct of_device_id rockchip_usb2phy_dt_match[] = {
279281
{ .compatible = "rockchip,rk3328-usb2phy", .data = &rk3328_phy_cfgs },
280282
{ .compatible = "rockchip,rk3366-usb2phy", .data = &rk3366_phy_cfgs },
281283
{ .compatible = "rockchip,rk3399-usb2phy", .data = &rk3399_phy_cfgs },

0 commit comments

Comments
 (0)