Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

Merge tag 'mmc-v6.2-rc5' of git://git.kernel.org/pub/scm/linux/kernel/git/ulfh/mmc

Pull MMC fixes from Ulf Hansson:
"MMC core:
- Fix potential resource leaks in SDIO card detection error path

MMC host:
- jz4740: Decrease maximum clock rate to workaround bug on JZ4760(B)
- meson-gx: Fix SDIO support to get some WiFi modules to work again
- mmc_spi: Fix error handling in ->probe()"

* tag 'mmc-v6.2-rc5' of git://git.kernel.org/pub/scm/linux/kernel/git/ulfh/mmc:
mmc: jz4740: Work around bug on JZ4760(B)
mmc: mmc_spi: fix error handling in mmc_spi_probe()
mmc: sdio: fix possible resource leaks in some error paths
mmc: meson-gx: fix SDIO mode if cap_sdio_irq isn't set

+41 -29
+14 -3
drivers/mmc/core/sdio_bus.c
··· 294 294 if (!(func->card->quirks & MMC_QUIRK_NONSTD_SDIO)) 295 295 sdio_free_func_cis(func); 296 296 297 + /* 298 + * We have now removed the link to the tuples in the 299 + * card structure, so remove the reference. 300 + */ 301 + put_device(&func->card->dev); 302 + 297 303 kfree(func->info); 298 304 kfree(func->tmpbuf); 299 305 kfree(func); ··· 329 323 func->card = card; 330 324 331 325 device_initialize(&func->dev); 326 + 327 + /* 328 + * We may link to tuples in the card structure, 329 + * we need make sure we have a reference to it. 330 + */ 331 + get_device(&func->card->dev); 332 332 333 333 func->dev.parent = &card->dev; 334 334 func->dev.bus = &sdio_bus_type; ··· 389 377 */ 390 378 void sdio_remove_func(struct sdio_func *func) 391 379 { 392 - if (!sdio_func_present(func)) 393 - return; 380 + if (sdio_func_present(func)) 381 + device_del(&func->dev); 394 382 395 - device_del(&func->dev); 396 383 of_node_put(func->dev.of_node); 397 384 put_device(&func->dev); 398 385 }
-12
drivers/mmc/core/sdio_cis.c
··· 404 404 return ret; 405 405 406 406 /* 407 - * Since we've linked to tuples in the card structure, 408 - * we must make sure we have a reference to it. 409 - */ 410 - get_device(&func->card->dev); 411 - 412 - /* 413 407 * Vendor/device id is optional for function CIS, so 414 408 * copy it from the card structure as needed. 415 409 */ ··· 428 434 } 429 435 430 436 func->tuples = NULL; 431 - 432 - /* 433 - * We have now removed the link to the tuples in the 434 - * card structure, so remove the reference. 435 - */ 436 - put_device(&func->card->dev); 437 437 } 438 438
+10
drivers/mmc/host/jz4740_mmc.c
··· 1053 1053 mmc->ops = &jz4740_mmc_ops; 1054 1054 if (!mmc->f_max) 1055 1055 mmc->f_max = JZ_MMC_CLK_RATE; 1056 + 1057 + /* 1058 + * There seems to be a problem with this driver on the JZ4760 and 1059 + * JZ4760B SoCs. There, when using the maximum rate supported (50 MHz), 1060 + * the communication fails with many SD cards. 1061 + * Until this bug is sorted out, limit the maximum rate to 24 MHz. 1062 + */ 1063 + if (host->version == JZ_MMC_JZ4760 && mmc->f_max > JZ_MMC_CLK_RATE) 1064 + mmc->f_max = JZ_MMC_CLK_RATE; 1065 + 1056 1066 mmc->f_min = mmc->f_max / 128; 1057 1067 mmc->ocr_avail = MMC_VDD_32_33 | MMC_VDD_33_34; 1058 1068
+13 -10
drivers/mmc/host/meson-gx-mmc.c
··· 435 435 clk_reg |= FIELD_PREP(CLK_CORE_PHASE_MASK, CLK_PHASE_180); 436 436 clk_reg |= FIELD_PREP(CLK_TX_PHASE_MASK, CLK_PHASE_0); 437 437 clk_reg |= FIELD_PREP(CLK_RX_PHASE_MASK, CLK_PHASE_0); 438 - clk_reg |= CLK_IRQ_SDIO_SLEEP(host); 438 + if (host->mmc->caps & MMC_CAP_SDIO_IRQ) 439 + clk_reg |= CLK_IRQ_SDIO_SLEEP(host); 439 440 writel(clk_reg, host->regs + SD_EMMC_CLOCK); 440 441 441 442 /* get the mux parents */ ··· 949 948 { 950 949 struct meson_host *host = dev_id; 951 950 struct mmc_command *cmd; 952 - u32 status, raw_status; 951 + u32 status, raw_status, irq_mask = IRQ_EN_MASK; 953 952 irqreturn_t ret = IRQ_NONE; 954 953 954 + if (host->mmc->caps & MMC_CAP_SDIO_IRQ) 955 + irq_mask |= IRQ_SDIO; 955 956 raw_status = readl(host->regs + SD_EMMC_STATUS); 956 - status = raw_status & (IRQ_EN_MASK | IRQ_SDIO); 957 + status = raw_status & irq_mask; 957 958 958 959 if (!status) { 959 960 dev_dbg(host->dev, 960 - "Unexpected IRQ! irq_en 0x%08lx - status 0x%08x\n", 961 - IRQ_EN_MASK | IRQ_SDIO, raw_status); 961 + "Unexpected IRQ! irq_en 0x%08x - status 0x%08x\n", 962 + irq_mask, raw_status); 962 963 return IRQ_NONE; 963 964 } 964 965 ··· 1207 1204 goto free_host; 1208 1205 } 1209 1206 1207 + mmc->caps |= MMC_CAP_CMD23; 1208 + 1209 + if (mmc->caps & MMC_CAP_SDIO_IRQ) 1210 + mmc->caps2 |= MMC_CAP2_SDIO_IRQ_NOTHREAD; 1211 + 1210 1212 host->data = (struct meson_mmc_data *) 1211 1213 of_device_get_match_data(&pdev->dev); 1212 1214 if (!host->data) { ··· 1284 1276 goto err_init_clk; 1285 1277 1286 1278 spin_lock_init(&host->lock); 1287 - 1288 - mmc->caps |= MMC_CAP_CMD23; 1289 - 1290 - if (mmc->caps & MMC_CAP_SDIO_IRQ) 1291 - mmc->caps2 |= MMC_CAP2_SDIO_IRQ_NOTHREAD; 1292 1279 1293 1280 if (host->dram_access_quirk) { 1294 1281 /* Limit segments to 1 due to low available sram memory */
+4 -4
drivers/mmc/host/mmc_spi.c
··· 1437 1437 1438 1438 status = mmc_add_host(mmc); 1439 1439 if (status != 0) 1440 - goto fail_add_host; 1440 + goto fail_glue_init; 1441 1441 1442 1442 /* 1443 1443 * Index 0 is card detect ··· 1445 1445 */ 1446 1446 status = mmc_gpiod_request_cd(mmc, NULL, 0, false, 1000); 1447 1447 if (status == -EPROBE_DEFER) 1448 - goto fail_add_host; 1448 + goto fail_gpiod_request; 1449 1449 if (!status) { 1450 1450 /* 1451 1451 * The platform has a CD GPIO signal that may support ··· 1460 1460 /* Index 1 is write protect/read only */ 1461 1461 status = mmc_gpiod_request_ro(mmc, NULL, 1, 0); 1462 1462 if (status == -EPROBE_DEFER) 1463 - goto fail_add_host; 1463 + goto fail_gpiod_request; 1464 1464 if (!status) 1465 1465 has_ro = true; 1466 1466 ··· 1474 1474 ? ", cd polling" : ""); 1475 1475 return 0; 1476 1476 1477 - fail_add_host: 1477 + fail_gpiod_request: 1478 1478 mmc_remove_host(mmc); 1479 1479 fail_glue_init: 1480 1480 mmc_spi_dma_free(host);