Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit dd174583 authored by Ke Liu's avatar Ke Liu
Browse files

gpio: qpnp-pin: fix qpnp_pin_probe issues



There are variables which should be declared as u32 instead of int. This
results in misbehavior when there are no gpio/mpp device nodes specified
in the topology. Also, the memory allocation size for q.chip->pmic_pins in
probe is miscalculated.

Hence change the variables to the correct type and update the memory
allocation size calculation for q.chip->pmic_pins.

Change-Id: Ibac3d24a2ad29cf3f605e3aff42a3f3093e40a7d
Signed-off-by: default avatarKe Liu <keliu@codeaurora.org>
parent bf291150
Loading
Loading
Loading
Loading
+3 −3
Original line number Diff line number Diff line
@@ -1184,7 +1184,7 @@ static int qpnp_pin_probe(struct spmi_device *spmi)
	struct resource *res;
	struct spmi_resource *d_node;
	int i, rc;
	int lowest_gpio = UINT_MAX, highest_gpio = 0;
	u32 lowest_gpio = UINT_MAX, highest_gpio = 0;
	u32 gpio;
	char version[Q_REG_SUBTYPE - Q_REG_DIG_MAJOR_REV + 1];
	const char *dev_name;
@@ -1242,7 +1242,7 @@ static int qpnp_pin_probe(struct spmi_device *spmi)

	/* allocate gpio lookup tables */
	q_chip->pmic_pins = kzalloc(sizeof(struct qpnp_pin_spec *) *
						highest_gpio - lowest_gpio + 1,
					(highest_gpio - lowest_gpio + 1),
					GFP_KERNEL);
	q_chip->chip_gpios = kzalloc(sizeof(struct qpnp_pin_spec *) *
						spmi->num_dev_node, GFP_KERNEL);