Commit 9696765b authored by Yong Cong Sin's avatar Yong Cong Sin Committed by Dan Kalowsky
Browse files

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: default avatarYong Cong Sin <yongcong.sin@gmail.com>
parent 095d3186
Loading
Loading
Loading
Loading
+4 −22
Original line number Diff line number Diff line
@@ -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

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;
	}