linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v2] phy: tegra: Remove self cast in tegra_xusb_port_find_lane
@ 2018-04-01 11:04 Nathan Chancellor
  2018-04-03 10:49 ` Thierry Reding
  0 siblings, 1 reply; 3+ messages in thread
From: Nathan Chancellor @ 2018-04-01 11:04 UTC (permalink / raw)
  To: Kishon Vijay Abraham I
  Cc: linux-kernel, linux-tegra, Thierry Reding, Jonathan Hunter,
	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 struct tegra_xusb_lane_map *' to itself
[-Wself-assign]
        for (map = map; map->type; map++) {
             ~~~ ^ ~~~

Signed-off-by: Nathan Chancellor <natechancellor@gmail.com>
---
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(-)

diff --git a/drivers/phy/tegra/xusb.c b/drivers/phy/tegra/xusb.c
index 63e916d4d069..11aa5902a9ac 100644
--- a/drivers/phy/tegra/xusb.c
+++ b/drivers/phy/tegra/xusb.c
@@ -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;
 
-- 
2.16.3

^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH v2] phy: tegra: Remove self cast in tegra_xusb_port_find_lane
  2018-04-01 11:04 [PATCH v2] phy: tegra: Remove self cast in tegra_xusb_port_find_lane Nathan Chancellor
@ 2018-04-03 10:49 ` Thierry Reding
  2018-04-03 12:39   ` Nathan Chancellor
  0 siblings, 1 reply; 3+ messages in thread
From: Thierry Reding @ 2018-04-03 10:49 UTC (permalink / raw)
  To: Nathan Chancellor
  Cc: Kishon Vijay Abraham I, linux-kernel, linux-tegra, Jonathan Hunter

[-- Attachment #1: Type: text/plain, Size: 1692 bytes --]

On Sun, Apr 01, 2018 at 04:04:10AM -0700, Nathan Chancellor wrote:
> 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++) {
>              ~~~ ^ ~~~
> 
> Signed-off-by: Nathan Chancellor <natechancellor@gmail.com>
> ---
> 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(-)
> 
> diff --git a/drivers/phy/tegra/xusb.c b/drivers/phy/tegra/xusb.c
> index 63e916d4d069..11aa5902a9ac 100644
> --- a/drivers/phy/tegra/xusb.c
> +++ b/drivers/phy/tegra/xusb.c
> @@ -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

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH v2] phy: tegra: Remove self cast in tegra_xusb_port_find_lane
  2018-04-03 10:49 ` Thierry Reding
@ 2018-04-03 12:39   ` Nathan Chancellor
  0 siblings, 0 replies; 3+ messages in thread
From: Nathan Chancellor @ 2018-04-03 12:39 UTC (permalink / raw)
  To: Thierry Reding
  Cc: Kishon Vijay Abraham I, linux-kernel, linux-tegra, Jonathan Hunter

On Tue, Apr 03, 2018 at 12:49:16PM +0200, Thierry Reding wrote:
> On Sun, Apr 01, 2018 at 04:04:10AM -0700, Nathan Chancellor wrote:
> > 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++) {
> >              ~~~ ^ ~~~
> > 
> > Signed-off-by: Nathan Chancellor <natechancellor@gmail.com>
> > ---
> > 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(-)
> > 
> > diff --git a/drivers/phy/tegra/xusb.c b/drivers/phy/tegra/xusb.c
> > index 63e916d4d069..11aa5902a9ac 100644
> > --- a/drivers/phy/tegra/xusb.c
> > +++ b/drivers/phy/tegra/xusb.c
> > @@ -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

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

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2018-04-03 12:39 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-04-01 11:04 [PATCH v2] phy: tegra: Remove self cast in tegra_xusb_port_find_lane Nathan Chancellor
2018-04-03 10:49 ` Thierry Reding
2018-04-03 12:39   ` Nathan Chancellor

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).