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

Commit 70be84de authored by Sultan Alsawaf's avatar Sultan Alsawaf Committed by Andrea
Browse files

qpnp-fg-gen3: Fix fg_sram_write() call in clear_cycle_counter()



This not only passes the incorrect size to fg_sram_write(), but also
uses incorrect syntax to pass the pointer of the payload to be written.
`chip->cyc_ctr.count` is defined as an array so there shouldn't be an
ampersand in front of it to get its address. We can also get its size
with just a plain sizeof().

Signed-off-by: default avatarSultan Alsawaf <sultan@kerneltoast.com>

qpnp-fg-gen3: Fix fg_sram_write() call in repeated clear_cycle_counter()

Signed-off-by: default avatarAndrea Pucci <linckandrea01@gmail.com>
parent 47025c2e
Loading
Loading
Loading
Loading
+4 −4
Original line number Diff line number Diff line
@@ -3193,8 +3193,8 @@ static void clear_cycle_counter(struct fg_chip *chip)
		chip->cyc_ctr.last_soc[i] = 0;
	}
	rc = fg_sram_write(chip, CYCLE_COUNT_WORD, CYCLE_COUNT_OFFSET,
			(u8 *)&chip->cyc_ctr.count,
			sizeof(chip->cyc_ctr.count) / (sizeof(u8 *)),
			(u8 *)chip->cyc_ctr.count,
			sizeof(chip->cyc_ctr.count),
			FG_IMA_DEFAULT);
	if (rc < 0)
		pr_err("failed to clear cycle counter rc=%d\n", rc);
@@ -3612,8 +3612,8 @@ static int fg_somc_write_back_sram_params(struct fg_chip *chip)

	/* Rewrite the CYCLE_COUNT */
	rc = fg_sram_write(chip, CYCLE_COUNT_WORD, CYCLE_COUNT_OFFSET,
			(u8 *)&chip->cyc_ctr.count,
			sizeof(chip->cyc_ctr.count) / sizeof(u8 *),
			(u8 *)chip->cyc_ctr.count,
			sizeof(chip->cyc_ctr.count),
			FG_IMA_DEFAULT);
	if (rc < 0) {
		pr_err("Error in rewriting cycle counter, rc=%d\n", rc);