All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] phy: cadence-torrent: Check return value on register read
@ 2024-07-02  3:20 ` Ma Ke
  0 siblings, 0 replies; 10+ messages in thread
From: Ma Ke @ 2024-07-02  3:20 UTC (permalink / raw)
  To: vkoul, kishon, rogerq, sjakhade, sergio.paracuellos, robh, make24
  Cc: linux-phy, linux-kernel

cdns_torrent_dp_set_power_state() does not consider that ret might be
overwritten. Add return value check of regmap_read_poll_timeout() after
register read in cdns_torrent_dp_set_power_state().

Fixes: 5b16a790f18d ("phy: cadence-torrent: Reorder few functions to remove function declarations")
Signed-off-by: Ma Ke <make24@iscas.ac.cn>
---
 drivers/phy/cadence/phy-cadence-torrent.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/drivers/phy/cadence/phy-cadence-torrent.c b/drivers/phy/cadence/phy-cadence-torrent.c
index 95924a09960c..6113f0022e6e 100644
--- a/drivers/phy/cadence/phy-cadence-torrent.c
+++ b/drivers/phy/cadence/phy-cadence-torrent.c
@@ -1156,6 +1156,9 @@ static int cdns_torrent_dp_set_power_state(struct cdns_torrent_phy *cdns_phy,
 	ret = regmap_read_poll_timeout(regmap, PHY_PMA_XCVR_POWER_STATE_ACK,
 				       read_val, (read_val & mask) == value, 0,
 				       POLL_TIMEOUT_US);
+	if (ret)
+		return ret;
+
 	cdns_torrent_dp_write(regmap, PHY_PMA_XCVR_POWER_STATE_REQ, 0x00000000);
 	ndelay(100);
 
-- 
2.25.1


-- 
linux-phy mailing list
linux-phy@lists.infradead.org
https://lists.infradead.org/mailman/listinfo/linux-phy

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

* [PATCH] phy: cadence-torrent: Check return value on register read
@ 2024-07-02  3:20 ` Ma Ke
  0 siblings, 0 replies; 10+ messages in thread
From: Ma Ke @ 2024-07-02  3:20 UTC (permalink / raw)
  To: vkoul, kishon, rogerq, sjakhade, sergio.paracuellos, robh, make24
  Cc: linux-phy, linux-kernel

cdns_torrent_dp_set_power_state() does not consider that ret might be
overwritten. Add return value check of regmap_read_poll_timeout() after
register read in cdns_torrent_dp_set_power_state().

Fixes: 5b16a790f18d ("phy: cadence-torrent: Reorder few functions to remove function declarations")
Signed-off-by: Ma Ke <make24@iscas.ac.cn>
---
 drivers/phy/cadence/phy-cadence-torrent.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/drivers/phy/cadence/phy-cadence-torrent.c b/drivers/phy/cadence/phy-cadence-torrent.c
index 95924a09960c..6113f0022e6e 100644
--- a/drivers/phy/cadence/phy-cadence-torrent.c
+++ b/drivers/phy/cadence/phy-cadence-torrent.c
@@ -1156,6 +1156,9 @@ static int cdns_torrent_dp_set_power_state(struct cdns_torrent_phy *cdns_phy,
 	ret = regmap_read_poll_timeout(regmap, PHY_PMA_XCVR_POWER_STATE_ACK,
 				       read_val, (read_val & mask) == value, 0,
 				       POLL_TIMEOUT_US);
+	if (ret)
+		return ret;
+
 	cdns_torrent_dp_write(regmap, PHY_PMA_XCVR_POWER_STATE_REQ, 0x00000000);
 	ndelay(100);
 
-- 
2.25.1


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

* Re: [PATCH] phy: cadence-torrent: Check return value on register read
  2024-07-02  3:20 ` Ma Ke
@ 2024-07-02  7:43   ` Markus Elfring
  -1 siblings, 0 replies; 10+ messages in thread
From: Markus Elfring @ 2024-07-02  7:43 UTC (permalink / raw)
  To: Ma Ke, linux-phy, kernel-janitors, Kishon Vijay Abraham I,
	Rob Herring, Roger Quadros, Sergio Paracuellos, Swapnil Jakhade,
	Vinod Koul
  Cc: LKML

> cdns_torrent_dp_set_power_state() does not consider that ret might be
> overwritten. Add return value check of regmap_read_poll_timeout() after
> register read in cdns_torrent_dp_set_power_state().

I suggest to improve such a change description another bit.

1. A return value is stored in the mentioned local variable.

2. Unfortunately, it was not immediately checked.

   * https://cwe.mitre.org/data/definitions/252.html

   * https://wiki.sei.cmu.edu/confluence/display/c/EXP12-C.+Do+not+ignore+values+returned+by+functions

3. How do you think about to avoid a repeated reference to a function name?


…
> Signed-off-by: Ma Ke <make24@iscas.ac.cn>

* Why was the personal name “Haoxiang Li” not specified here?

* Under which circumstances will applications of the Developer's Certificate of Origin
  be clarified better?
  https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/Documentation/process/submitting-patches.rst?h=v6.10-rc6#n398


How do you think about to use a summary phrase like “Complete error handling
in cdns_torrent_dp_set_power_state()”?

Regards,
Markus

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

* Re: [PATCH] phy: cadence-torrent: Check return value on register read
@ 2024-07-02  7:43   ` Markus Elfring
  0 siblings, 0 replies; 10+ messages in thread
From: Markus Elfring @ 2024-07-02  7:43 UTC (permalink / raw)
  To: Ma Ke, linux-phy, kernel-janitors, Kishon Vijay Abraham I,
	Rob Herring, Roger Quadros, Sergio Paracuellos, Swapnil Jakhade,
	Vinod Koul
  Cc: LKML

> cdns_torrent_dp_set_power_state() does not consider that ret might be
> overwritten. Add return value check of regmap_read_poll_timeout() after
> register read in cdns_torrent_dp_set_power_state().

I suggest to improve such a change description another bit.

1. A return value is stored in the mentioned local variable.

2. Unfortunately, it was not immediately checked.

   * https://cwe.mitre.org/data/definitions/252.html

   * https://wiki.sei.cmu.edu/confluence/display/c/EXP12-C.+Do+not+ignore+values+returned+by+functions

3. How do you think about to avoid a repeated reference to a function name?


…
> Signed-off-by: Ma Ke <make24@iscas.ac.cn>

* Why was the personal name “Haoxiang Li” not specified here?

* Under which circumstances will applications of the Developer's Certificate of Origin
  be clarified better?
  https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/Documentation/process/submitting-patches.rst?h=v6.10-rc6#n398


How do you think about to use a summary phrase like “Complete error handling
in cdns_torrent_dp_set_power_state()”?

Regards,
Markus

-- 
linux-phy mailing list
linux-phy@lists.infradead.org
https://lists.infradead.org/mailman/listinfo/linux-phy

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

* Re: [PATCH] phy: cadence-torrent: Check return value on register read
  2024-07-02  3:20 ` Ma Ke
@ 2024-07-02 11:54   ` Roger Quadros
  -1 siblings, 0 replies; 10+ messages in thread
From: Roger Quadros @ 2024-07-02 11:54 UTC (permalink / raw)
  To: Ma Ke, vkoul, kishon, sjakhade, sergio.paracuellos, robh
  Cc: linux-phy, linux-kernel



On 02/07/2024 06:20, Ma Ke wrote:
> cdns_torrent_dp_set_power_state() does not consider that ret might be
> overwritten. Add return value check of regmap_read_poll_timeout() after
> register read in cdns_torrent_dp_set_power_state().
> 
> Fixes: 5b16a790f18d ("phy: cadence-torrent: Reorder few functions to remove function declarations")
> Signed-off-by: Ma Ke <make24@iscas.ac.cn>

Reviewed-by: Roger Quadros <rogerq@kernel.org>

-- 
linux-phy mailing list
linux-phy@lists.infradead.org
https://lists.infradead.org/mailman/listinfo/linux-phy

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

* Re: [PATCH] phy: cadence-torrent: Check return value on register read
@ 2024-07-02 11:54   ` Roger Quadros
  0 siblings, 0 replies; 10+ messages in thread
From: Roger Quadros @ 2024-07-02 11:54 UTC (permalink / raw)
  To: Ma Ke, vkoul, kishon, sjakhade, sergio.paracuellos, robh
  Cc: linux-phy, linux-kernel



On 02/07/2024 06:20, Ma Ke wrote:
> cdns_torrent_dp_set_power_state() does not consider that ret might be
> overwritten. Add return value check of regmap_read_poll_timeout() after
> register read in cdns_torrent_dp_set_power_state().
> 
> Fixes: 5b16a790f18d ("phy: cadence-torrent: Reorder few functions to remove function declarations")
> Signed-off-by: Ma Ke <make24@iscas.ac.cn>

Reviewed-by: Roger Quadros <rogerq@kernel.org>

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

* Re: [PATCH] phy: cadence-torrent: Check return value on register read
  2024-07-02  7:43   ` Markus Elfring
@ 2024-07-02 13:12     ` Vinod Koul
  -1 siblings, 0 replies; 10+ messages in thread
From: Vinod Koul @ 2024-07-02 13:12 UTC (permalink / raw)
  To: Markus Elfring
  Cc: Ma Ke, linux-phy, kernel-janitors, Kishon Vijay Abraham I,
	Rob Herring, Roger Quadros, Sergio Paracuellos, Swapnil Jakhade,
	LKML

On 02-07-24, 09:43, Markus Elfring wrote:
> > cdns_torrent_dp_set_power_state() does not consider that ret might be
> > overwritten. Add return value check of regmap_read_poll_timeout() after
> > register read in cdns_torrent_dp_set_power_state().
> 
> I suggest to improve such a change description another bit.
> 
> 1. A return value is stored in the mentioned local variable.
> 
> 2. Unfortunately, it was not immediately checked.
> 
>    * https://cwe.mitre.org/data/definitions/252.html
> 
>    * https://wiki.sei.cmu.edu/confluence/display/c/EXP12-C.+Do+not+ignore+values+returned+by+functions
> 
> 3. How do you think about to avoid a repeated reference to a function name?


<form letter>
Feel free to ignore all comments from Markus, regardless whether the
suggestion is reasonable or not. This person is banned from LKML and
several maintainers ignore Markus' feedback, because it is just a waste
of time.
</form letter>

-- 
~Vinod

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

* Re: [PATCH] phy: cadence-torrent: Check return value on register read
@ 2024-07-02 13:12     ` Vinod Koul
  0 siblings, 0 replies; 10+ messages in thread
From: Vinod Koul @ 2024-07-02 13:12 UTC (permalink / raw)
  To: Markus Elfring
  Cc: Ma Ke, linux-phy, kernel-janitors, Kishon Vijay Abraham I,
	Rob Herring, Roger Quadros, Sergio Paracuellos, Swapnil Jakhade,
	LKML

On 02-07-24, 09:43, Markus Elfring wrote:
> > cdns_torrent_dp_set_power_state() does not consider that ret might be
> > overwritten. Add return value check of regmap_read_poll_timeout() after
> > register read in cdns_torrent_dp_set_power_state().
> 
> I suggest to improve such a change description another bit.
> 
> 1. A return value is stored in the mentioned local variable.
> 
> 2. Unfortunately, it was not immediately checked.
> 
>    * https://cwe.mitre.org/data/definitions/252.html
> 
>    * https://wiki.sei.cmu.edu/confluence/display/c/EXP12-C.+Do+not+ignore+values+returned+by+functions
> 
> 3. How do you think about to avoid a repeated reference to a function name?


<form letter>
Feel free to ignore all comments from Markus, regardless whether the
suggestion is reasonable or not. This person is banned from LKML and
several maintainers ignore Markus' feedback, because it is just a waste
of time.
</form letter>

-- 
~Vinod

-- 
linux-phy mailing list
linux-phy@lists.infradead.org
https://lists.infradead.org/mailman/listinfo/linux-phy

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

* Re: [PATCH] phy: cadence-torrent: Check return value on register read
  2024-07-02  3:20 ` Ma Ke
@ 2024-07-02 13:35   ` Vinod Koul
  -1 siblings, 0 replies; 10+ messages in thread
From: Vinod Koul @ 2024-07-02 13:35 UTC (permalink / raw)
  To: kishon, rogerq, sjakhade, sergio.paracuellos, robh, Ma Ke
  Cc: linux-phy, linux-kernel


On Tue, 02 Jul 2024 11:20:42 +0800, Ma Ke wrote:
> cdns_torrent_dp_set_power_state() does not consider that ret might be
> overwritten. Add return value check of regmap_read_poll_timeout() after
> register read in cdns_torrent_dp_set_power_state().
> 
> 

Applied, thanks!

[1/1] phy: cadence-torrent: Check return value on register read
      commit: 967969cf594ed3c1678a9918d6e9bb2d1591cbe9

Best regards,
-- 
Vinod Koul <vkoul@kernel.org>


-- 
linux-phy mailing list
linux-phy@lists.infradead.org
https://lists.infradead.org/mailman/listinfo/linux-phy

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

* Re: [PATCH] phy: cadence-torrent: Check return value on register read
@ 2024-07-02 13:35   ` Vinod Koul
  0 siblings, 0 replies; 10+ messages in thread
From: Vinod Koul @ 2024-07-02 13:35 UTC (permalink / raw)
  To: kishon, rogerq, sjakhade, sergio.paracuellos, robh, Ma Ke
  Cc: linux-phy, linux-kernel


On Tue, 02 Jul 2024 11:20:42 +0800, Ma Ke wrote:
> cdns_torrent_dp_set_power_state() does not consider that ret might be
> overwritten. Add return value check of regmap_read_poll_timeout() after
> register read in cdns_torrent_dp_set_power_state().
> 
> 

Applied, thanks!

[1/1] phy: cadence-torrent: Check return value on register read
      commit: 967969cf594ed3c1678a9918d6e9bb2d1591cbe9

Best regards,
-- 
Vinod Koul <vkoul@kernel.org>


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

end of thread, other threads:[~2024-07-02 13:36 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-07-02  3:20 [PATCH] phy: cadence-torrent: Check return value on register read Ma Ke
2024-07-02  3:20 ` Ma Ke
2024-07-02  7:43 ` Markus Elfring
2024-07-02  7:43   ` Markus Elfring
2024-07-02 13:12   ` Vinod Koul
2024-07-02 13:12     ` Vinod Koul
2024-07-02 11:54 ` Roger Quadros
2024-07-02 11:54   ` Roger Quadros
2024-07-02 13:35 ` Vinod Koul
2024-07-02 13:35   ` Vinod Koul

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.