Commit 564de762 authored by Stephen Rothwell's avatar Stephen Rothwell Committed by Lee Jones

mfd: kempld-core: Fix 'assignment of read-only location' error

 drivers/mfd/kempld-core.c: In function 'kempld_register_cells_generic':
 drivers/mfd/kempld-core.c:105:13: error: assignment of read-only location 'devs[i++]'
  105 |   devs[i++] = kempld_devs[KEMPLD_I2C];
      |             ^
 drivers/mfd/kempld-core.c:108:13: error: assignment of read-only location 'devs[i++]'
  108 |   devs[i++] = kempld_devs[KEMPLD_WDT];
      |             ^
 drivers/mfd/kempld-core.c:111:13: error: assignment of read-only location 'devs[i++]'
  111 |   devs[i++] = kempld_devs[KEMPLD_GPIO];
      |             ^
 drivers/mfd/kempld-core.c:114:13: error: assignment of read-only location 'devs[i++]'
  114 |   devs[i++] = kempld_devs[KEMPLD_UART];
      |             ^

Fixes: e49aa9a9bd22 ("mfd: core: Make a best effort attempt to match devices with the correct of_nodes")
Signed-off-by: default avatarStephen Rothwell <sfr@canb.auug.org.au>
Signed-off-by: default avatarLee Jones <lee.jones@linaro.org>
parent 85c30785
...@@ -79,39 +79,31 @@ enum kempld_cells { ...@@ -79,39 +79,31 @@ enum kempld_cells {
KEMPLD_UART, KEMPLD_UART,
}; };
static const struct mfd_cell kempld_devs[] = { static const char *kempld_dev_names[] = {
[KEMPLD_I2C] = { [KEMPLD_I2C] = "kempld-i2c",
.name = "kempld-i2c", [KEMPLD_WDT] = "kempld-wdt",
}, [KEMPLD_GPIO] = "kempld-gpio",
[KEMPLD_WDT] = { [KEMPLD_UART] = "kempld-uart",
.name = "kempld-wdt",
},
[KEMPLD_GPIO] = {
.name = "kempld-gpio",
},
[KEMPLD_UART] = {
.name = "kempld-uart",
},
}; };
#define KEMPLD_MAX_DEVS ARRAY_SIZE(kempld_devs) #define KEMPLD_MAX_DEVS ARRAY_SIZE(kempld_dev_names)
static int kempld_register_cells_generic(struct kempld_device_data *pld) static int kempld_register_cells_generic(struct kempld_device_data *pld)
{ {
struct mfd_cell devs[KEMPLD_MAX_DEVS]; struct mfd_cell devs[KEMPLD_MAX_DEVS] = {};
int i = 0; int i = 0;
if (pld->feature_mask & KEMPLD_FEATURE_BIT_I2C) if (pld->feature_mask & KEMPLD_FEATURE_BIT_I2C)
devs[i++] = kempld_devs[KEMPLD_I2C]; devs[i++].name = kempld_dev_names[KEMPLD_I2C];
if (pld->feature_mask & KEMPLD_FEATURE_BIT_WATCHDOG) if (pld->feature_mask & KEMPLD_FEATURE_BIT_WATCHDOG)
devs[i++] = kempld_devs[KEMPLD_WDT]; devs[i++].name = kempld_dev_names[KEMPLD_WDT];
if (pld->feature_mask & KEMPLD_FEATURE_BIT_GPIO) if (pld->feature_mask & KEMPLD_FEATURE_BIT_GPIO)
devs[i++] = kempld_devs[KEMPLD_GPIO]; devs[i++].name = kempld_dev_names[KEMPLD_GPIO];
if (pld->feature_mask & KEMPLD_FEATURE_MASK_UART) if (pld->feature_mask & KEMPLD_FEATURE_MASK_UART)
devs[i++] = kempld_devs[KEMPLD_UART]; devs[i++].name = kempld_dev_names[KEMPLD_UART];
return mfd_add_devices(pld->dev, -1, devs, i, NULL, 0, NULL); return mfd_add_devices(pld->dev, -1, devs, i, NULL, 0, NULL);
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment