From c477602c408fb97ae40355aba2b859394bed202d Mon Sep 17 00:00:00 2001 From: Pisit Sawangvonganan Date: Thu, 31 Oct 2024 12:14:09 +0700 Subject: [PATCH 1/2] drivers: eeprom: at2x: remove '&' when assigning `init_fn` To maintain consistency in `init_fn` parameter passing, remove the address-of operator ('&') when assigning the `init_fn` function pointer in the `DEVICE_DT_INST_DEFINE` macro. Signed-off-by: Pisit Sawangvonganan --- drivers/eeprom/eeprom_at2x.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/eeprom/eeprom_at2x.c b/drivers/eeprom/eeprom_at2x.c index 31161554659e98..b6bc00a5b6f8a0 100644 --- a/drivers/eeprom/eeprom_at2x.c +++ b/drivers/eeprom/eeprom_at2x.c @@ -648,7 +648,7 @@ static const struct eeprom_driver_api eeprom_at2x_api = { .write_fn = eeprom_at##t##_write, \ }; \ static struct eeprom_at2x_data eeprom_at##t##_data_##n; \ - DEVICE_DT_DEFINE(INST_DT_AT2X(n, t), &eeprom_at2x_init, \ + DEVICE_DT_DEFINE(INST_DT_AT2X(n, t), eeprom_at2x_init, \ NULL, &eeprom_at##t##_data_##n, \ &eeprom_at##t##_config_##n, POST_KERNEL, \ CONFIG_EEPROM_AT2X_INIT_PRIORITY, \ From ed9048c8c1d9a9cc2c8d1252cd5410da00bffc3f Mon Sep 17 00:00:00 2001 From: Pisit Sawangvonganan Date: Thu, 31 Oct 2024 13:47:35 +0700 Subject: [PATCH 2/2] drivers: eeprom: at2x: remove orphaned `k_mutex_unlock` Remove orphaned `k_mutex_unlock` in `eeprom_at25_read` as the lock/unlock pair is handled in `eeprom_at2x_read` instead. Signed-off-by: Pisit Sawangvonganan --- drivers/eeprom/eeprom_at2x.c | 2 -- 1 file changed, 2 deletions(-) diff --git a/drivers/eeprom/eeprom_at2x.c b/drivers/eeprom/eeprom_at2x.c index b6bc00a5b6f8a0..1de8a42e225791 100644 --- a/drivers/eeprom/eeprom_at2x.c +++ b/drivers/eeprom/eeprom_at2x.c @@ -419,7 +419,6 @@ static int eeprom_at25_read(const struct device *dev, off_t offset, void *buf, size_t len) { const struct eeprom_at2x_config *config = dev->config; - struct eeprom_at2x_data *data = dev->data; size_t cmd_len = 1 + config->addr_width / 8; uint8_t cmd[4] = { EEPROM_AT25_READ, 0, 0, 0 }; uint8_t *paddr; @@ -474,7 +473,6 @@ static int eeprom_at25_read(const struct device *dev, off_t offset, void *buf, err = eeprom_at25_wait_for_idle(dev); if (err) { LOG_ERR("EEPROM idle wait failed (err %d)", err); - k_mutex_unlock(&data->lock); return err; }