mtd: spi-nor: macronix: use nor->addr_nbytes
authorTudor Ambarus <tudor.ambarus@linaro.org>
Mon, 11 Nov 2024 11:36:09 +0000 (13:36 +0200)
committerPratyush Yadav <pratyush@kernel.org>
Fri, 6 Dec 2024 15:49:32 +0000 (15:49 +0000)
Use the nor->addr_nbytes set by the core, we shouldn't use
magic numbers or states that are not tracked by the core.

Signed-off-by: Tudor Ambarus <tudor.ambarus@linaro.org>
Acked-by: Pratyush Yadav <pratyush@kernel.org>
Signed-off-by: Pratyush Yadav <pratyush@kernel.org>
Link: https://lore.kernel.org/r/20241111113609.12093-1-tudor.ambarus@linaro.org
drivers/mtd/spi-nor/macronix.c

index 830da21eea08fe4e289eb1d62faccd760b1a05f4..57a40fa70c6a1f79a5d26ec264d952df614e509d 100644 (file)
@@ -230,7 +230,8 @@ static int macronix_nor_octal_dtr_en(struct spi_nor *nor)
                return ret;
 
        /* Read flash ID to make sure the switch was successful. */
-       ret = spi_nor_read_id(nor, 4, 4, buf, SNOR_PROTO_8_8_8_DTR);
+       ret = spi_nor_read_id(nor, nor->addr_nbytes, 4, buf,
+                             SNOR_PROTO_8_8_8_DTR);
        if (ret) {
                dev_dbg(nor->dev, "error %d reading JEDEC ID after enabling 8D-8D-8D mode\n", ret);
                return ret;