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

Commit 9774f5b4 authored by Abinaya P's avatar Abinaya P
Browse files

leds: leds-qpnp: avoid truncation in qpnp_led_masked_write function



Since the last parameter of qpnp_led_masked_write function is
of type 'u8', make sure that only value of type 'u8' is passed
to this parameter of function to avoid truncation.

Change-Id: If047f844fc45713b77c4561a88253dade3c4c478
Signed-off-by: default avatarAbinaya P <abinayap@codeaurora.org>
parent fdc49c46
Loading
Loading
Loading
Loading
+6 −4
Original line number Diff line number Diff line
@@ -704,7 +704,7 @@ static int qpnp_wled_set(struct qpnp_led_data *led)
		for (i = 0; i < num_wled_strings; i++) {
			rc = qpnp_led_masked_write(led,
				WLED_FULL_SCALE_REG(led->base, i),
				WLED_MAX_CURR_MASK, led->max_current);
				WLED_MAX_CURR_MASK, (u8)led->max_current);
			if (rc) {
				dev_err(&led->spmi_dev->dev,
					"Write max current failure (%d)\n",
@@ -803,7 +803,8 @@ static int qpnp_wled_set(struct qpnp_led_data *led)

static int qpnp_mpp_set(struct qpnp_led_data *led)
{
	int rc, val;
	int rc;
	u8 val;
	int duty_us;

	if (led->cdev.brightness) {
@@ -1771,7 +1772,7 @@ static int qpnp_wled_init(struct qpnp_led_data *led)

		rc = qpnp_led_masked_write(led,
			WLED_FULL_SCALE_REG(led->base, i), WLED_MAX_CURR_MASK,
			led->max_current);
			(u8)led->max_current);
		if (rc) {
			dev_err(&led->spmi_dev->dev,
				"WLED max current reg write failed(%d)\n", rc);
@@ -2612,7 +2613,8 @@ static int qpnp_rgb_init(struct qpnp_led_data *led)

static int qpnp_mpp_init(struct qpnp_led_data *led)
{
	int rc, val;
	int rc;
	u8 val;


	if (led->max_current < LED_MPP_CURRENT_MIN ||