of: property: fw_devlink: Fix stupid bug in remote-endpoint parsing

Message ID 20240224052436.3552333-1-saravanak@google.com
State New
Headers
Series of: property: fw_devlink: Fix stupid bug in remote-endpoint parsing |

Commit Message

Saravana Kannan Feb. 24, 2024, 5:24 a.m. UTC
  Introduced a stupid bug in commit 782bfd03c3ae ("of: property: Improve
finding the supplier of a remote-endpoint property") due to a last minute
incorrect edit of "index !=0" into "!index". This patch fixes it to be
"index > 0" to match the comment right next to it.

Reported-by: Luca Ceresoli <luca.ceresoli@bootlin.com>
Link: https://lore.kernel.org/lkml/20240223171849.10f9901d@booty/
Fixes: 782bfd03c3ae ("of: property: Improve finding the supplier of a remote-endpoint property")
Signed-off-by: Saravana Kannan <saravanak@google.com>
---
Using Link: instead of Closes: because Luca reported two separate issues.

Sorry about introducing a stupid bug in an -rcX Rob.

-Saravana

 drivers/of/property.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
  

Comments

Saravana Kannan Feb. 24, 2024, 5:28 a.m. UTC | #1
On Fri, Feb 23, 2024 at 9:24 PM Saravana Kannan <saravanak@google.com> wrote:
>
> Introduced a stupid bug in commit 782bfd03c3ae ("of: property: Improve
> finding the supplier of a remote-endpoint property") due to a last minute
> incorrect edit of "index !=0" into "!index". This patch fixes it to be
> "index > 0" to match the comment right next to it.

Greg, this needs to land in the stable branches once Rob picks it up
for the next 6.8-rc.

-Saravana

>
> Reported-by: Luca Ceresoli <luca.ceresoli@bootlin.com>
> Link: https://lore.kernel.org/lkml/20240223171849.10f9901d@booty/
> Fixes: 782bfd03c3ae ("of: property: Improve finding the supplier of a remote-endpoint property")
> Signed-off-by: Saravana Kannan <saravanak@google.com>
> ---
> Using Link: instead of Closes: because Luca reported two separate issues.
>
> Sorry about introducing a stupid bug in an -rcX Rob.
>
> -Saravana
>
>  drivers/of/property.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/of/property.c b/drivers/of/property.c
> index b71267c6667c..fa8cd33be131 100644
> --- a/drivers/of/property.c
> +++ b/drivers/of/property.c
> @@ -1304,7 +1304,7 @@ static struct device_node *parse_remote_endpoint(struct device_node *np,
>                                                  int index)
>  {
>         /* Return NULL for index > 0 to signify end of remote-endpoints. */
> -       if (!index || strcmp(prop_name, "remote-endpoint"))
> +       if (index > 0 || strcmp(prop_name, "remote-endpoint"))
>                 return NULL;
>
>         return of_graph_get_remote_port_parent(np);
> --
> 2.44.0.rc0.258.g7320e95886-goog
>
  
Luca Ceresoli Feb. 26, 2024, 8:19 a.m. UTC | #2
On Fri, 23 Feb 2024 21:24:35 -0800
Saravana Kannan <saravanak@google.com> wrote:

> Introduced a stupid bug in commit 782bfd03c3ae ("of: property: Improve
> finding the supplier of a remote-endpoint property") due to a last minute
> incorrect edit of "index !=0" into "!index". This patch fixes it to be
> "index > 0" to match the comment right next to it.
> 
> Reported-by: Luca Ceresoli <luca.ceresoli@bootlin.com>
> Link: https://lore.kernel.org/lkml/20240223171849.10f9901d@booty/
> Fixes: 782bfd03c3ae ("of: property: Improve finding the supplier of a remote-endpoint property")
> Signed-off-by: Saravana Kannan <saravanak@google.com>

Reviewed-by: Luca Ceresoli <luca.ceresoli@bootlin.com>
Tested-by: Luca Ceresoli <luca.ceresoli@bootlin.com>
  
Herve Codina Feb. 26, 2024, 8:56 a.m. UTC | #3
Hi Saravana,

On Fri, 23 Feb 2024 21:24:35 -0800
Saravana Kannan <saravanak@google.com> wrote:

> Introduced a stupid bug in commit 782bfd03c3ae ("of: property: Improve
> finding the supplier of a remote-endpoint property") due to a last minute
> incorrect edit of "index !=0" into "!index". This patch fixes it to be
> "index > 0" to match the comment right next to it.
> 
> Reported-by: Luca Ceresoli <luca.ceresoli@bootlin.com>
> Link: https://lore.kernel.org/lkml/20240223171849.10f9901d@booty/
> Fixes: 782bfd03c3ae ("of: property: Improve finding the supplier of a remote-endpoint property")
> Signed-off-by: Saravana Kannan <saravanak@google.com>
> ---
> Using Link: instead of Closes: because Luca reported two separate issues.
> 
> Sorry about introducing a stupid bug in an -rcX Rob.
> 

Reviewed-by: Herve Codina <herve.codina@bootlin.com>

Best regards,
Hervé
  
Rob Herring Feb. 29, 2024, 12:20 a.m. UTC | #4
On Fri, Feb 23, 2024 at 11:29 PM Saravana Kannan <saravanak@google.com> wrote:
>
> On Fri, Feb 23, 2024 at 9:24 PM Saravana Kannan <saravanak@googlecom> wrote:
> >
> > Introduced a stupid bug in commit 782bfd03c3ae ("of: property: Improve
> > finding the supplier of a remote-endpoint property") due to a last minute
> > incorrect edit of "index !=0" into "!index". This patch fixes it to be
> > "index > 0" to match the comment right next to it.
>
> Greg, this needs to land in the stable branches once Rob picks it up
> for the next 6.8-rc.

Uh, what? Only if I ignore this patch until 6.8 is released.
Otherwise, the bug and fix are both landing in 6.8.

Rob
  
Geert Uytterhoeven Feb. 29, 2024, 10:11 a.m. UTC | #5
Hi Saravana,

On Sat, Feb 24, 2024 at 6:25 AM Saravana Kannan <saravanak@google.com> wrote:
> Introduced a stupid bug in commit 782bfd03c3ae ("of: property: Improve
> finding the supplier of a remote-endpoint property") due to a last minute
> incorrect edit of "index !=0" into "!index". This patch fixes it to be
> "index > 0" to match the comment right next to it.
>
> Reported-by: Luca Ceresoli <luca.ceresoli@bootlin.com>
> Link: https://lore.kernel.org/lkml/20240223171849.10f9901d@booty/
> Fixes: 782bfd03c3ae ("of: property: Improve finding the supplier of a remote-endpoint property")
> Signed-off-by: Saravana Kannan <saravanak@google.com>

Thanks for your patch!

> --- a/drivers/of/property.c
> +++ b/drivers/of/property.c
> @@ -1304,7 +1304,7 @@ static struct device_node *parse_remote_endpoint(struct device_node *np,
>                                                  int index)
>  {
>         /* Return NULL for index > 0 to signify end of remote-endpoints. */
> -       if (!index || strcmp(prop_name, "remote-endpoint"))
> +       if (index > 0 || strcmp(prop_name, "remote-endpoint"))
>                 return NULL;
>
>         return of_graph_get_remote_port_parent(np);
> --
> 2.44.0.rc0.258.g7320e95886-goog

After this, the "Fixed dependency cycle" messages I reported to be
gone in [1] are back.

In fact, they are slightly different, and there are now even more of them:

-platform fea80000.csi2: Fixed dependency cycle(s) with
/soc/video@e6ef7000/ports/port@1/endpoint@0
-platform fea80000.csi2: Fixed dependency cycle(s) with
/soc/video@e6ef6000/ports/port@1/endpoint@0
-platform fea80000.csi2: Fixed dependency cycle(s) with
/soc/video@e6ef5000/ports/port@1/endpoint@0
-platform fea80000.csi2: Fixed dependency cycle(s) with
/soc/video@e6ef4000/ports/port@1/endpoint@0
-platform fea80000.csi2: Fixed dependency cycle(s) with
/soc/video@e6ef3000/ports/port@1/endpoint@0
-platform fea80000.csi2: Fixed dependency cycle(s) with
/soc/video@e6ef2000/ports/port@1/endpoint@0
-platform fea80000.csi2: Fixed dependency cycle(s) with
/soc/video@e6ef1000/ports/port@1/endpoint@0
-platform fea80000.csi2: Fixed dependency cycle(s) with
/soc/video@e6ef0000/ports/port@1/endpoint@0
-platform feaa0000.csi2: Fixed dependency cycle(s) with
/soc/video@e6ef3000/ports/port@1/endpoint@2
-platform feaa0000.csi2: Fixed dependency cycle(s) with
/soc/video@e6ef2000/ports/port@1/endpoint@2
-platform feaa0000.csi2: Fixed dependency cycle(s) with
/soc/video@e6ef1000/ports/port@1/endpoint@2
-platform feaa0000.csi2: Fixed dependency cycle(s) with
/soc/video@e6ef0000/ports/port@1/endpoint@2
-platform fead0000.hdmi: Fixed dependency cycle(s) with
/soc/sound@ec500000/ports/port@1/endpoint
-platform feae0000.hdmi: Fixed dependency cycle(s) with
/soc/sound@ec500000/ports/port@2/endpoint
-platform feb00000.display: Fixed dependency cycle(s) with
/soc/hdmi@feae0000/ports/port@0/endpoint
-platform feb00000.display: Fixed dependency cycle(s) with
/soc/hdmi@fead0000/ports/port@0/endpoint
-platform hdmi0-out: Fixed dependency cycle(s) with
/soc/hdmi@fead0000/ports/port@1/endpoint
-platform hdmi1-out: Fixed dependency cycle(s) with
/soc/hdmi@feae0000/ports/port@1/endpoint
-platform vga-encoder: Fixed dependency cycle(s) with /vga/port/endpoint
-platform vga-encoder: Fixed dependency cycle(s) with
/soc/display@feb00000/ports/port@0/endpoint
+platform e6ef0000.video: Fixed dependency cycle(s) with /soc/csi2@feaa0000
+platform e6ef0000.video: Fixed dependency cycle(s) with /soc/csi2@fea80000
+platform e6ef1000.video: Fixed dependency cycle(s) with /soc/csi2@feaa0000
+platform e6ef1000.video: Fixed dependency cycle(s) with /soc/csi2@fea80000
+platform e6ef2000.video: Fixed dependency cycle(s) with /soc/csi2@feaa0000
+platform e6ef2000.video: Fixed dependency cycle(s) with /soc/csi2@fea80000
+platform e6ef3000.video: Fixed dependency cycle(s) with /soc/csi2@feaa0000
+platform e6ef3000.video: Fixed dependency cycle(s) with /soc/csi2@fea80000
+platform e6ef4000.video: Fixed dependency cycle(s) with /soc/csi2@fea80000
+platform e6ef5000.video: Fixed dependency cycle(s) with /soc/csi2@fea80000
+platform e6ef6000.video: Fixed dependency cycle(s) with /soc/csi2@fea80000
+platform e6ef7000.video: Fixed dependency cycle(s) with /soc/csi2@fea80000
+platform ec500000.sound: Fixed dependency cycle(s) with /soc/hdmi@feae0000
+platform ec500000.sound: Fixed dependency cycle(s) with /soc/hdmi@fead0000
+platform ec500000.sound: Fixed dependency cycle(s) with
/soc/i2c@e6510000/codec@10
+platform e6ef7000.video: Fixed dependency cycle(s) with /soc/csi2@fea80000
+platform e6ef6000.video: Fixed dependency cycle(s) with /soc/csi2@fea80000
+platform e6ef5000.video: Fixed dependency cycle(s) with /soc/csi2@fea80000
+platform e6ef4000.video: Fixed dependency cycle(s) with /soc/csi2@fea80000
+platform e6ef3000.video: Fixed dependency cycle(s) with /soc/csi2@fea80000
+platform e6ef2000.video: Fixed dependency cycle(s) with /soc/csi2@fea80000
+platform e6ef1000.video: Fixed dependency cycle(s) with /soc/csi2@fea80000
+platform e6ef0000.video: Fixed dependency cycle(s) with /soc/csi2@fea80000
+platform fea80000.csi2: Fixed dependency cycle(s) with /soc/video@e6ef7000
+platform fea80000.csi2: Fixed dependency cycle(s) with /soc/video@e6ef6000
+platform fea80000.csi2: Fixed dependency cycle(s) with /soc/video@e6ef5000
+platform fea80000.csi2: Fixed dependency cycle(s) with /soc/video@e6ef4000
+platform fea80000.csi2: Fixed dependency cycle(s) with /soc/video@e6ef3000
+platform fea80000.csi2: Fixed dependency cycle(s) with /soc/video@e6ef2000
+platform fea80000.csi2: Fixed dependency cycle(s) with /soc/video@e6ef1000
+platform fea80000.csi2: Fixed dependency cycle(s) with /soc/video@e6ef0000
+platform fea80000.csi2: Fixed dependency cycle(s) with
/soc/i2c@e66d8000/video-receiver@70
+platform e6ef3000.video: Fixed dependency cycle(s) with /soc/csi2@feaa0000
+platform e6ef2000.video: Fixed dependency cycle(s) with /soc/csi2@feaa0000
+platform e6ef1000.video: Fixed dependency cycle(s) with /soc/csi2@feaa0000
+platform e6ef0000.video: Fixed dependency cycle(s) with /soc/csi2@feaa0000
+platform feaa0000.csi2: Fixed dependency cycle(s) with /soc/video@e6ef3000
+platform feaa0000.csi2: Fixed dependency cycle(s) with /soc/video@e6ef2000
+platform feaa0000.csi2: Fixed dependency cycle(s) with /soc/video@e6ef1000
+platform feaa0000.csi2: Fixed dependency cycle(s) with /soc/video@e6ef0000
+platform feaa0000.csi2: Fixed dependency cycle(s) with
/soc/i2c@e66d8000/video-receiver@70
+platform ec500000.sound: Fixed dependency cycle(s) with /soc/hdmi@fead0000
+platform fead0000.hdmi: Fixed dependency cycle(s) with /soc/sound@ec500000
+platform fead0000.hdmi: Fixed dependency cycle(s) with /soc/display@feb00000
+platform ec500000.sound: Fixed dependency cycle(s) with /soc/hdmi@feae0000
+platform feae0000.hdmi: Fixed dependency cycle(s) with /soc/sound@ec500000
+platform feae0000.hdmi: Fixed dependency cycle(s) with /soc/display@feb00000
+platform feae0000.hdmi: Fixed dependency cycle(s) with /soc/display@feb00000
+platform fead0000.hdmi: Fixed dependency cycle(s) with /soc/display@feb00000
+platform feb00000.display: Fixed dependency cycle(s) with /soc/hdmi@feae0000
+platform feb00000.display: Fixed dependency cycle(s) with /soc/hdmi@fead0000
+platform cvbs-in: Fixed dependency cycle(s) with
/soc/i2c@e66d8000/video-receiver@70
+platform hdmi-in: Fixed dependency cycle(s) with
/soc/i2c@e66d8000/video-receiver@70
+platform fead0000.hdmi: Fixed dependency cycle(s) with /hdmi0-out
+platform hdmi0-out: Fixed dependency cycle(s) with /soc/hdmi@fead0000
+platform feae0000.hdmi: Fixed dependency cycle(s) with /hdmi1-out
+platform hdmi1-out: Fixed dependency cycle(s) with /soc/hdmi@feae0000
+platform vga: Fixed dependency cycle(s) with /vga-encoder
+platform feb00000.display: Fixed dependency cycle(s) with /vga-encoder
+platform vga-encoder: Fixed dependency cycle(s) with /vga
+platform vga-encoder: Fixed dependency cycle(s) with /soc/display@feb00000

-i2c 2-0010: Fixed dependency cycle(s) with
/soc/sound@ec500000/ports/port@0/endpoint
+platform ec500000.sound: Fixed dependency cycle(s) with
/soc/i2c@e6510000/codec@10

-i2c 4-0070: Fixed dependency cycle(s) with
/soc/csi2@fea80000/ports/port@0/endpoint
-i2c 4-0070: Fixed dependency cycle(s) with
/soc/csi2@feaa0000/ports/port@0/endpoint
-i2c 4-0070: Fixed dependency cycle(s) with /hdmi-in/port/endpoint
-i2c 4-0070: Fixed dependency cycle(s) with /cvbs-in/port/endpoint
+platform feaa0000.csi2: Fixed dependency cycle(s) with
/soc/i2c@e66d8000/video-receiver@70
+platform fea80000.csi2: Fixed dependency cycle(s) with
/soc/i2c@e66d8000/video-receiver@70
+i2c 4-0070: Fixed dependency cycle(s) with /soc/csi2@fea80000
+i2c 4-0070: Fixed dependency cycle(s) with /soc/csi2@feaa0000

I guess all of that is expected?

[1] https://lore.kernel.org/all/CAMuHMdVon3mdivZQ0O6D4+va0nGBrUQbDp23bEq661QD=4t7+g@mail.gmail.com/

Gr{oetje,eeting}s,

                        Geert
  
Rob Herring March 1, 2024, 9:28 p.m. UTC | #6
On Fri, 23 Feb 2024 21:24:35 -0800, Saravana Kannan wrote:
> Introduced a stupid bug in commit 782bfd03c3ae ("of: property: Improve
> finding the supplier of a remote-endpoint property") due to a last minute
> incorrect edit of "index !=0" into "!index". This patch fixes it to be
> "index > 0" to match the comment right next to it.
> 
> Reported-by: Luca Ceresoli <luca.ceresoli@bootlin.com>
> Link: https://lore.kernel.org/lkml/20240223171849.10f9901d@booty/
> Fixes: 782bfd03c3ae ("of: property: Improve finding the supplier of a remote-endpoint property")
> Signed-off-by: Saravana Kannan <saravanak@google.com>
> ---
> Using Link: instead of Closes: because Luca reported two separate issues.
> 
> Sorry about introducing a stupid bug in an -rcX Rob.
> 
> -Saravana
> 
>  drivers/of/property.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 

Applied, thanks!
  

Patch

diff --git a/drivers/of/property.c b/drivers/of/property.c
index b71267c6667c..fa8cd33be131 100644
--- a/drivers/of/property.c
+++ b/drivers/of/property.c
@@ -1304,7 +1304,7 @@  static struct device_node *parse_remote_endpoint(struct device_node *np,
 						 int index)
 {
 	/* Return NULL for index > 0 to signify end of remote-endpoints. */
-	if (!index || strcmp(prop_name, "remote-endpoint"))
+	if (index > 0 || strcmp(prop_name, "remote-endpoint"))
 		return NULL;
 
 	return of_graph_get_remote_port_parent(np);