Browse Source

drivers: syscon: remove unnecessary checks for `dev` pointer

The `dev` pointer passed to the implementation should never be `NULL`,
remove the checks.

Signed-off-by: Yong Cong Sin <yongcong.sin@gmail.com>
pull/92715/head
Yong Cong Sin 3 weeks ago committed by Dan Kalowsky
parent
commit
9696765b56
  1. 26
      drivers/syscon/syscon.c

26
drivers/syscon/syscon.c

@ -29,27 +29,16 @@ struct syscon_generic_data { @@ -29,27 +29,16 @@ struct syscon_generic_data {
static int syscon_generic_get_base(const struct device *dev, uintptr_t *addr)
{
if (!dev) {
return -ENODEV;
}
*addr = DEVICE_MMIO_GET(dev);
return 0;
}
static int syscon_generic_read_reg(const struct device *dev, uint16_t reg, uint32_t *val)
{
const struct syscon_generic_config *config;
struct syscon_generic_data *data;
const struct syscon_generic_config *config = dev->config;
struct syscon_generic_data *data = dev->data;
uintptr_t base_address;
if (!dev) {
return -ENODEV;
}
data = dev->data;
config = dev->config;
if (!val) {
return -EINVAL;
}
@ -79,17 +68,10 @@ static int syscon_generic_read_reg(const struct device *dev, uint16_t reg, uint3 @@ -79,17 +68,10 @@ static int syscon_generic_read_reg(const struct device *dev, uint16_t reg, uint3
static int syscon_generic_write_reg(const struct device *dev, uint16_t reg, uint32_t val)
{
const struct syscon_generic_config *config;
struct syscon_generic_data *data;
const struct syscon_generic_config *config = dev->config;
struct syscon_generic_data *data = dev->data;
uintptr_t base_address;
if (!dev) {
return -ENODEV;
}
data = dev->data;
config = dev->config;
if (syscon_sanitize_reg(&reg, data->size, config->reg_width)) {
return -EINVAL;
}

Loading…
Cancel
Save