phy: tegra: Remove self cast in tegra_xusb_port_find_lane
PATCH v2 1/1 phy: tegra: Remove self cast in tegra_xusb_port_find_lane
Clang warns about casting variables to themselves because it is rarely necessary. Removing the cast should not change anything regarding the code and silences the warning.
../drivers/phy/tegra/xusb.c:421:11: warning: explicitly assigning value of variable of type 'const struct tegra_xusb_lane_map *' to itself [-Wself-assign]
for (map = map; map->type; map++) {
~~~ ^ ~~~---
I am not entirely sure if this is the correct solution, especially since I don't have the hardware and I am not too familiar with this code. If there is a better solution, please let me know.
Changes from v1 -> v2: Fix spelling error in commit title
drivers/phy/tegra/xusb.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/phy/tegra/xusb.c +1 -1
@@ -418,7 +418,7 @@ tegra_xusb_port_find_lane(struct tegra_xusb_port *port, {struct tegra_xusb_lane *lane, *match =ERR_PTR (-ENODEV ); -for (map = map; map->type; map++) { +for (; map->type; map++) {if (port->index != map->port)continue ;
Signature · 1 line
2.16.3
Quoted 26 lines · Nathan Chancellor
Clang warns about casting variables to themselves because it is rarely necessary. Removing the cast should not change anything regarding the code and silences the warning.
../drivers/phy/tegra/xusb.c:421:11: warning: explicitly assigning value of variable of type 'const structtegra_xusb_lane_map*' to itself [-Wself-assign]for (map = map; map->type; map++) { ~~~ ^ ~~~Signed-off-by Nathan Chancellor <[email protected]>---
I am not entirely sure if this is the correct solution, especially since I don't have the hardware and I am not too familiar with this code. If there is a better solution, please let me know.Changes from v1 -> v2: Fix spelling error in commit title
drivers/phy/tegra/xusb.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)drivers/phy/tegra/xusb.c +0
-0
drivers/phy/tegra/xusb.c tegra_xusb_port_find_lane(struct tegra_xusb_port *port, · line 424
Quoted 8 lines
drivers/phy/tegra/xusb.c +1
-1@@ -418,7 +418,7 @@ tegra_xusb_port_find_lane(struct tegra_xusb_port *port, {struct tegra_xusb_lane *lane, *match =ERR_PTR (-ENODEV ); -for (map = map; map->type; map++) { +for (; map->type; map++) {if (port->index != map->port)continue ;
An equivalent patch seems to already have been merged. See:
https://patchwork.kernel.org/patch/10072641/
You can avoid duplication of effort such as this by basing any patches you send on top of a recent linux-next. The above patch, for example, was added in next-20180223.
Thanks,
Thierry
Quoted 38 lines · Thierry Reding
Quoted 26 lines · Nathan Chancellor
Clang warns about casting variables to themselves because it is rarely necessary. Removing the cast should not change anything regarding the code and silences the warning.
../drivers/phy/tegra/xusb.c:421:11: warning: explicitly assigning value of variable of type 'const structtegra_xusb_lane_map*' to itself [-Wself-assign]for (map = map; map->type; map++) { ~~~ ^ ~~~Signed-off-by Nathan Chancellor <[email protected]>---
I am not entirely sure if this is the correct solution, especially since I don't have the hardware and I am not too familiar with this code. If there is a better solution, please let me know.Changes from v1 -> v2: Fix spelling error in commit title
drivers/phy/tegra/xusb.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)drivers/phy/tegra/xusb.c +0
-0drivers/phy/tegra/xusb.c tegra_xusb_port_find_lane(struct tegra_xusb_port *port, · line 424
Quoted 8 lines
drivers/phy/tegra/xusb.c +1
-1@@ -418,7 +418,7 @@ tegra_xusb_port_find_lane(struct tegra_xusb_port *port, {struct tegra_xusb_lane *lane, *match =ERR_PTR (-ENODEV ); -for (map = map; map->type; map++) { +for (; map->type; map++) {if (port->index != map->port)continue ;An equivalent patch seems to already have been merged. See:
Quoted 8 lines
https://patchwork.kernel.org/patch/10072641/You can avoid duplication of effort such as this by basing any patches you send on top of a recent linux-next. The above patch, for example, was added in next-20180223.
Thanks,
Thierry
Hi Thierry,
Thanks for the response. My apologies for not basing on linux-next; I thought I did a cursory glance at both the phy and tegra trees but apparently I didn't do it close enough. Definitely won't make the same mistake again.
Cheers!
Nathan