[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-Id: <20220830171155.42962-1-andriy.shevchenko@linux.intel.com>
Date: Tue, 30 Aug 2022 20:11:53 +0300
From: Andy Shevchenko <andriy.shevchenko@...ux.intel.com>
To: Andy Shevchenko <andriy.shevchenko@...ux.intel.com>,
Hans de Goede <hdegoede@...hat.com>,
linux-acpi@...r.kernel.org, linux-kernel@...r.kernel.org
Cc: "Rafael J. Wysocki" <rafael@...nel.org>,
Len Brown <lenb@...nel.org>, Andy Shevchenko <andy@...nel.org>,
Mika Westerberg <mika.westerberg@...ux.intel.com>
Subject: [PATCH v2 1/3] ACPI: PMIC: Use sizeof() instead of hard coded value
It's better to use sizeof() of a given buffer than spreading
a hard coded value.
Signed-off-by: Andy Shevchenko <andriy.shevchenko@...ux.intel.com>
---
v2: updated another driver as well (due to this no tag added)
drivers/acpi/pmic/intel_pmic_chtdc_ti.c | 2 +-
drivers/acpi/pmic/intel_pmic_xpower.c | 2 +-
2 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/drivers/acpi/pmic/intel_pmic_chtdc_ti.c b/drivers/acpi/pmic/intel_pmic_chtdc_ti.c
index 418eec523025..6c2a6da430ed 100644
--- a/drivers/acpi/pmic/intel_pmic_chtdc_ti.c
+++ b/drivers/acpi/pmic/intel_pmic_chtdc_ti.c
@@ -87,7 +87,7 @@ static int chtdc_ti_pmic_get_raw_temp(struct regmap *regmap, int reg)
{
u8 buf[2];
- if (regmap_bulk_read(regmap, reg, buf, 2))
+ if (regmap_bulk_read(regmap, reg, buf, sizeof(buf)))
return -EIO;
/* stored in big-endian */
diff --git a/drivers/acpi/pmic/intel_pmic_xpower.c b/drivers/acpi/pmic/intel_pmic_xpower.c
index 61bbe4c24d87..33c5e85294cd 100644
--- a/drivers/acpi/pmic/intel_pmic_xpower.c
+++ b/drivers/acpi/pmic/intel_pmic_xpower.c
@@ -255,7 +255,7 @@ static int intel_xpower_pmic_get_raw_temp(struct regmap *regmap, int reg)
if (ret)
return ret;
- ret = regmap_bulk_read(regmap, AXP288_GP_ADC_H, buf, 2);
+ ret = regmap_bulk_read(regmap, AXP288_GP_ADC_H, buf, sizeof(buf));
if (ret == 0)
ret = (buf[0] << 4) + ((buf[1] >> 4) & 0x0f);
--
2.35.1
Powered by blists - more mailing lists