From: "Ilpo Järvinen" <ilpo.jarvinen@linux.intel.com>
To: Vadim Pasternak <vadimp@nvidia.com>
Cc: Hans de Goede <hdegoede@redhat.com>,
michaelsh@nvidia.com, crajank@nvidia.com, fradensky@nvidia.com,
oleksandrs@nvidia.com, platform-driver-x86@vger.kernel.org
Subject: Re: [PATCH v5 09/12] platform: mellanox: Cosmetic changes to improve code style
Date: Mon, 3 Feb 2025 16:35:45 +0200 (EET) [thread overview]
Message-ID: <0259fb04-d49e-1f6f-392a-d8e8a917fd33@linux.intel.com> (raw)
In-Reply-To: <20250124172632.22437-10-vadimp@nvidia.com>
On Fri, 24 Jan 2025, Vadim Pasternak wrote:
> Replace in 'for' loop - /i >= 0 ; i--/i >= 0 ;i--/.
> Replace in 'while' loop - /(--i >= 0)/(--i)/.
>
> Signed-off-by: Vadim Pasternak <vadimp@nvidia.com>
> ---
> drivers/platform/mellanox/mlx-platform.c | 8 ++++----
> 1 file changed, 4 insertions(+), 4 deletions(-)
>
> diff --git a/drivers/platform/mellanox/mlx-platform.c b/drivers/platform/mellanox/mlx-platform.c
> index 4ed0f05449d5..ee72a53a8b06 100644
> --- a/drivers/platform/mellanox/mlx-platform.c
> +++ b/drivers/platform/mellanox/mlx-platform.c
> @@ -7850,7 +7850,7 @@ static int mlxplat_platdevs_init(struct mlxplat_priv *priv)
> while (--i)
> platform_device_unregister(priv->pdev_dpu[i]);
> fail_platform_wd_register:
> - while (--i >= 0)
> + while (--i)
> platform_device_unregister(priv->pdev_wd[i]);
These are not equal, 0th element will not get unregistered. You need to
use postdecrement so that value 1 becomes 0 while indexing it:
while (i--)
There's one similar problem also in the code added in the previous patch.
> fail_platform_fan_register:
> if (mlxplat_regs_io)
> @@ -7871,7 +7871,7 @@ static void mlxplat_platdevs_exit(struct mlxplat_priv *priv)
>
> for (i = MLXPLAT_CPLD_DPU_MAX_DEVS - 1; i >= 0; i--)
> platform_device_unregister(priv->pdev_dpu[i]);
> - for (i = MLXPLAT_CPLD_WD_MAX_DEVS - 1; i >= 0 ; i--)
> + for (i = MLXPLAT_CPLD_WD_MAX_DEVS - 1; i >= 0; i--)
> platform_device_unregister(priv->pdev_wd[i]);
> if (priv->pdev_fan)
> platform_device_unregister(priv->pdev_fan);
> @@ -7916,7 +7916,7 @@ static int mlxplat_i2c_mux_topology_init(struct mlxplat_priv *priv)
> return mlxplat_i2c_mux_complition_notify(priv, NULL, NULL);
>
> fail_platform_mux_register:
> - while (--i >= 0)
> + while (--i)
Ditto.
> platform_device_unregister(priv->pdev_mux[i]);
> return err;
> }
> @@ -7925,7 +7925,7 @@ static void mlxplat_i2c_mux_topology_exit(struct mlxplat_priv *priv)
> {
> int i;
>
> - for (i = mlxplat_mux_num - 1; i >= 0 ; i--) {
> + for (i = mlxplat_mux_num - 1; i >= 0; i--) {
> if (priv->pdev_mux[i])
> platform_device_unregister(priv->pdev_mux[i]);
> }
>
--
i.
next prev parent reply other threads:[~2025-02-03 14:35 UTC|newest]
Thread overview: 25+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-01-24 17:26 [PATCH v5 00/12] platform/mellanox: Add support for new systems, amendments, relocate mlx-platform module Vadim Pasternak
2025-01-24 17:26 ` [PATCH v5 01/12] mellanox: Relocate mlx-platform driver Vadim Pasternak
2025-02-04 14:33 ` Ilpo Järvinen
2025-01-24 17:26 ` [PATCH v5 02/12] platform: mellanox: mlx-platform: Cosmetic changes Vadim Pasternak
2025-01-24 17:26 ` [PATCH v5 03/12] platform: mellanox: mlx-platform: Change register name Vadim Pasternak
2025-01-24 17:26 ` [PATCH v5 04/12] platform_data/mlxreg: Add capability bit and mask fields Vadim Pasternak
2025-02-03 13:50 ` Ilpo Järvinen
2025-02-10 20:30 ` Vadim Pasternak
2025-01-24 17:26 ` [PATCH v5 05/12] platform/mellanox: mlxreg-hotplug: Add support for new flavor of capability registers Vadim Pasternak
2025-02-03 13:47 ` Ilpo Järvinen
2025-02-10 20:30 ` Vadim Pasternak
2025-02-11 14:48 ` Ilpo Järvinen
2025-01-24 17:26 ` [PATCH v5 06/12] platform/mellanox: Rename field to improve code readability Vadim Pasternak
2025-02-03 13:52 ` Ilpo Järvinen
2025-01-24 17:26 ` [PATCH v5 07/12] platform/mellanox: mlxreg-dpu: Add initial support for Nvidia DPU Vadim Pasternak
2025-02-03 14:20 ` Ilpo Järvinen
2025-01-24 17:26 ` [PATCH v5 08/12] platform: mellanox: Introduce support of Nvidia smart switch Vadim Pasternak
2025-02-03 14:32 ` Ilpo Järvinen
2025-01-24 17:26 ` [PATCH v5 09/12] platform: mellanox: Cosmetic changes to improve code style Vadim Pasternak
2025-02-03 14:35 ` Ilpo Järvinen [this message]
2025-01-24 17:26 ` [PATCH v5 10/12] platform: mellanox: mlx-platform: Add support for new Nvidia system Vadim Pasternak
2025-02-03 14:38 ` Ilpo Järvinen
2025-01-24 17:26 ` [PATCH v5 11/12] platform: mellanox: nvsw-sn2200: Add support for new system flavour Vadim Pasternak
2025-01-24 17:26 ` [PATCH v5 12/12] Documentation/ABI: Add new attribute for mlxreg-io sysfs interfaces Vadim Pasternak
2025-02-03 14:40 ` Ilpo Järvinen
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=0259fb04-d49e-1f6f-392a-d8e8a917fd33@linux.intel.com \
--to=ilpo.jarvinen@linux.intel.com \
--cc=crajank@nvidia.com \
--cc=fradensky@nvidia.com \
--cc=hdegoede@redhat.com \
--cc=michaelsh@nvidia.com \
--cc=oleksandrs@nvidia.com \
--cc=platform-driver-x86@vger.kernel.org \
--cc=vadimp@nvidia.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox