linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] regulator: scmi: Use int type to store negative error codes
@ 2025-08-29 10:14 Qianfeng Rong
  2025-08-29 10:25 ` Sudeep Holla
  2025-09-01 22:15 ` Mark Brown
  0 siblings, 2 replies; 3+ messages in thread
From: Qianfeng Rong @ 2025-08-29 10:14 UTC (permalink / raw)
  To: Sudeep Holla, Cristian Marussi, Liam Girdwood, Mark Brown,
	arm-scmi, linux-arm-kernel, linux-kernel
  Cc: Qianfeng Rong

Change the 'ret' variable from u32 to int to store negative error codes or
zero returned by of_property_read_u32().

Storing the negative error codes in unsigned type, doesn't cause an issue
at runtime but it's ugly as pants. Additionally, assigning negative error
codes to unsigned type may trigger a GCC warning when the -Wsign-conversion
flag is enabled.

No effect on runtime.

Signed-off-by: Qianfeng Rong <rongqianfeng@vivo.com>
---
 drivers/regulator/scmi-regulator.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/drivers/regulator/scmi-regulator.c b/drivers/regulator/scmi-regulator.c
index 9df726f10ad1..6d609c42e479 100644
--- a/drivers/regulator/scmi-regulator.c
+++ b/drivers/regulator/scmi-regulator.c
@@ -257,7 +257,8 @@ static int process_scmi_regulator_of_node(struct scmi_device *sdev,
 					  struct device_node *np,
 					  struct scmi_regulator_info *rinfo)
 {
-	u32 dom, ret;
+	u32 dom;
+	int ret;
 
 	ret = of_property_read_u32(np, "reg", &dom);
 	if (ret)
-- 
2.34.1


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

* Re: [PATCH] regulator: scmi: Use int type to store negative error codes
  2025-08-29 10:14 [PATCH] regulator: scmi: Use int type to store negative error codes Qianfeng Rong
@ 2025-08-29 10:25 ` Sudeep Holla
  2025-09-01 22:15 ` Mark Brown
  1 sibling, 0 replies; 3+ messages in thread
From: Sudeep Holla @ 2025-08-29 10:25 UTC (permalink / raw)
  To: Qianfeng Rong
  Cc: Cristian Marussi, Sudeep Holla, Liam Girdwood, Mark Brown,
	arm-scmi, linux-arm-kernel, linux-kernel

On Fri, Aug 29, 2025 at 06:14:11PM +0800, Qianfeng Rong wrote:
> Change the 'ret' variable from u32 to int to store negative error codes or
> zero returned by of_property_read_u32().
> 
> Storing the negative error codes in unsigned type, doesn't cause an issue
> at runtime but it's ugly as pants. Additionally, assigning negative error
> codes to unsigned type may trigger a GCC warning when the -Wsign-conversion
> flag is enabled.
> 
> No effect on runtime.
>

Reviewed-by: Sudeep Holla <sudeep.holla@arm.com>

Mark,

Not sure if it is worth adding:

Fixes: 0fbeae70ee7c ("regulator: add SCMI driver")

Especially if value > 0 is not treated as error in some driver using
regulator APIs.

-- 
Regards,
Sudeep

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

* Re: [PATCH] regulator: scmi: Use int type to store negative error codes
  2025-08-29 10:14 [PATCH] regulator: scmi: Use int type to store negative error codes Qianfeng Rong
  2025-08-29 10:25 ` Sudeep Holla
@ 2025-09-01 22:15 ` Mark Brown
  1 sibling, 0 replies; 3+ messages in thread
From: Mark Brown @ 2025-09-01 22:15 UTC (permalink / raw)
  To: Sudeep Holla, Cristian Marussi, Liam Girdwood, arm-scmi,
	linux-arm-kernel, linux-kernel, Qianfeng Rong

On Fri, 29 Aug 2025 18:14:11 +0800, Qianfeng Rong wrote:
> Change the 'ret' variable from u32 to int to store negative error codes or
> zero returned by of_property_read_u32().
> 
> Storing the negative error codes in unsigned type, doesn't cause an issue
> at runtime but it's ugly as pants. Additionally, assigning negative error
> codes to unsigned type may trigger a GCC warning when the -Wsign-conversion
> flag is enabled.
> 
> [...]

Applied to

   https://git.kernel.org/pub/scm/linux/kernel/git/broonie/regulator.git for-next

Thanks!

[1/1] regulator: scmi: Use int type to store negative error codes
      commit: 9d35d068fb138160709e04e3ee97fe29a6f8615b

All being well this means that it will be integrated into the linux-next
tree (usually sometime in the next 24 hours) and sent to Linus during
the next merge window (or sooner if it is a bug fix), however if
problems are discovered then the patch may be dropped or reverted.

You may get further e-mails resulting from automated or manual testing
and review of the tree, please engage with people reporting problems and
send followup patches addressing any issues that are reported if needed.

If any updates are required or you are submitting further changes they
should be sent as incremental updates against current git, existing
patches will not be replaced.

Please add any relevant lists and maintainers to the CCs when replying
to this mail.

Thanks,
Mark


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

end of thread, other threads:[~2025-09-01 22:15 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-08-29 10:14 [PATCH] regulator: scmi: Use int type to store negative error codes Qianfeng Rong
2025-08-29 10:25 ` Sudeep Holla
2025-09-01 22:15 ` Mark Brown

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).