summaryrefslogtreecommitdiffstats
path: root/drivers/platform/x86
diff options
context:
space:
mode:
authorAndy Shevchenko <andriy.shevchenko@linux.intel.com>2022-07-10 00:16:51 +0300
committerHans de Goede <hdegoede@redhat.com>2022-07-10 17:59:51 +0200
commited7adc2b69c6492ebb2733d8914c6d765ec9770b (patch)
tree39f4cc7cab2336d29e6af77ba97666cb17207e2a /drivers/platform/x86
parent14a9aa99aca6c28728de357b7be3c9ef4f2a5bb6 (diff)
downloadlinux-ed7adc2b69c6492ebb2733d8914c6d765ec9770b.tar.gz
linux-ed7adc2b69c6492ebb2733d8914c6d765ec9770b.tar.bz2
linux-ed7adc2b69c6492ebb2733d8914c6d765ec9770b.zip
platform/x86: serial-multi-instantiate: Use while (i--) pattern to clean up
Use more natural while (i--) patter to clean up allocated resources. Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com> Reviewed-by: Hans de Goede <hdegoede@redhat.com> Link: https://lore.kernel.org/r/20220709211653.18938-4-andriy.shevchenko@linux.intel.com Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Diffstat (limited to 'drivers/platform/x86')
-rw-r--r--drivers/platform/x86/serial-multi-instantiate.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/drivers/platform/x86/serial-multi-instantiate.c b/drivers/platform/x86/serial-multi-instantiate.c
index 970ede0ff002..0a2335693f4f 100644
--- a/drivers/platform/x86/serial-multi-instantiate.c
+++ b/drivers/platform/x86/serial-multi-instantiate.c
@@ -70,11 +70,11 @@ static int smi_get_irq(struct platform_device *pdev, struct acpi_device *adev,
static void smi_devs_unregister(struct smi *smi)
{
- while (smi->i2c_num > 0)
- i2c_unregister_device(smi->i2c_devs[--smi->i2c_num]);
+ while (smi->i2c_num--)
+ i2c_unregister_device(smi->i2c_devs[smi->i2c_num]);
- while (smi->spi_num > 0)
- spi_unregister_device(smi->spi_devs[--smi->spi_num]);
+ while (smi->spi_num--)
+ spi_unregister_device(smi->spi_devs[smi->spi_num]);
}
/**