Skip to content

Commit bbacf71

Browse files
committed
Merge tag 'mtd/fixes-for-6.9-rc6' of git://git.kernel.org/pub/scm/linux/kernel/git/mtd/linux
Pull MTD fixes from Miquel Raynal: "There has been OTP support improvements in the NVMEM subsystem, and later also improvements of OTP support in the NAND subsystem. This lead to situations that we currently cannot handle, so better prevent this situation from happening in order to avoid canceling device's probe. In the raw NAND subsystem, two runtime fixes have been shared, one fixing two important commands in the Qcom driver since it got reworked and a NULL pointer dereference happening on STB chips. Arnd also fixed a UBSAN link failure on diskonchip" * tag 'mtd/fixes-for-6.9-rc6' of git://git.kernel.org/pub/scm/linux/kernel/git/mtd/linux: mtd: limit OTP NVMEM cell parse to non-NAND devices mtd: diskonchip: work around ubsan link failure mtd: rawnand: qcom: Fix broken OP_RESET_DEVICE command in qcom_misc_cmd_type_exec() mtd: rawnand: brcmnand: Fix data access violation for STB chip
2 parents 3022bf3 + d2d73a6 commit bbacf71

File tree

4 files changed

+7
-8
lines changed

4 files changed

+7
-8
lines changed

drivers/mtd/mtdcore.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -900,7 +900,7 @@ static struct nvmem_device *mtd_otp_nvmem_register(struct mtd_info *mtd,
900900
config.name = compatible;
901901
config.id = NVMEM_DEVID_AUTO;
902902
config.owner = THIS_MODULE;
903-
config.add_legacy_fixed_of_cells = true;
903+
config.add_legacy_fixed_of_cells = !mtd_type_is_nand(mtd);
904904
config.type = NVMEM_TYPE_OTP;
905905
config.root_only = true;
906906
config.ignore_wp = true;

drivers/mtd/nand/raw/brcmnand/brcmnand.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -857,7 +857,7 @@ static inline void brcmnand_read_data_bus(struct brcmnand_controller *ctrl,
857857
struct brcmnand_soc *soc = ctrl->soc;
858858
int i;
859859

860-
if (soc->read_data_bus) {
860+
if (soc && soc->read_data_bus) {
861861
soc->read_data_bus(soc, flash_cache, buffer, fc_words);
862862
} else {
863863
for (i = 0; i < fc_words; i++)

drivers/mtd/nand/raw/diskonchip.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ static unsigned long doc_locations[] __initdata = {
5353
0xe8000, 0xea000, 0xec000, 0xee000,
5454
#endif
5555
#endif
56-
0xffffffff };
56+
};
5757

5858
static struct mtd_info *doclist = NULL;
5959

@@ -1554,7 +1554,7 @@ static int __init init_nanddoc(void)
15541554
if (ret < 0)
15551555
return ret;
15561556
} else {
1557-
for (i = 0; (doc_locations[i] != 0xffffffff); i++) {
1557+
for (i = 0; i < ARRAY_SIZE(doc_locations); i++) {
15581558
doc_probe(doc_locations[i]);
15591559
}
15601560
}

drivers/mtd/nand/raw/qcom_nandc.c

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2815,7 +2815,7 @@ static int qcom_misc_cmd_type_exec(struct nand_chip *chip, const struct nand_sub
28152815
host->cfg0_raw & ~(7 << CW_PER_PAGE));
28162816
nandc_set_reg(chip, NAND_DEV0_CFG1, host->cfg1_raw);
28172817
instrs = 3;
2818-
} else {
2818+
} else if (q_op.cmd_reg != OP_RESET_DEVICE) {
28192819
return 0;
28202820
}
28212821

@@ -2830,9 +2830,8 @@ static int qcom_misc_cmd_type_exec(struct nand_chip *chip, const struct nand_sub
28302830
nandc_set_reg(chip, NAND_EXEC_CMD, 1);
28312831

28322832
write_reg_dma(nandc, NAND_FLASH_CMD, instrs, NAND_BAM_NEXT_SGL);
2833-
(q_op.cmd_reg == OP_BLOCK_ERASE) ? write_reg_dma(nandc, NAND_DEV0_CFG0,
2834-
2, NAND_BAM_NEXT_SGL) : read_reg_dma(nandc,
2835-
NAND_FLASH_STATUS, 1, NAND_BAM_NEXT_SGL);
2833+
if (q_op.cmd_reg == OP_BLOCK_ERASE)
2834+
write_reg_dma(nandc, NAND_DEV0_CFG0, 2, NAND_BAM_NEXT_SGL);
28362835

28372836
write_reg_dma(nandc, NAND_EXEC_CMD, 1, NAND_BAM_NEXT_SGL);
28382837
read_reg_dma(nandc, NAND_FLASH_STATUS, 1, NAND_BAM_NEXT_SGL);

0 commit comments

Comments
 (0)