From 4b83456a8b93d659794d9ceb9153730d2f63d091 Mon Sep 17 00:00:00 2001 From: Greg Kroah-Hartman Date: Thu, 12 Dec 2024 12:07:03 +0100 Subject: [PATCH] 5.15-stable patches added patches: drm-amd-display-check-bios-images-before-it-is-used.patch mmc-mtk-sd-fix-error-handle-of-probe-function.patch --- ...-check-bios-images-before-it-is-used.patch | 82 +++++++++++++++++++ ...d-fix-error-handle-of-probe-function.patch | 81 ++++++++++++++++++ queue-5.15/series | 3 +- 3 files changed, 165 insertions(+), 1 deletion(-) create mode 100644 queue-5.15/drm-amd-display-check-bios-images-before-it-is-used.patch create mode 100644 queue-5.15/mmc-mtk-sd-fix-error-handle-of-probe-function.patch diff --git a/queue-5.15/drm-amd-display-check-bios-images-before-it-is-used.patch b/queue-5.15/drm-amd-display-check-bios-images-before-it-is-used.patch new file mode 100644 index 00000000000..f4d406ca62a --- /dev/null +++ b/queue-5.15/drm-amd-display-check-bios-images-before-it-is-used.patch @@ -0,0 +1,82 @@ +From 8b0ddf19cca2a352b2a7e01d99d3ba949a99c84c Mon Sep 17 00:00:00 2001 +From: Alex Hung +Date: Mon, 3 Jun 2024 08:24:13 -0600 +Subject: drm/amd/display: Check BIOS images before it is used + +From: Alex Hung + +commit 8b0ddf19cca2a352b2a7e01d99d3ba949a99c84c upstream. + +BIOS images may fail to load and null checks are added before they are +used. + +This fixes 6 NULL_RETURNS issues reported by Coverity. + +Reviewed-by: Harry Wentland +Acked-by: Hamza Mahfooz +Signed-off-by: Alex Hung +Signed-off-by: Alex Deucher +Signed-off-by: Keerthana K +Signed-off-by: Greg Kroah-Hartman +--- + drivers/gpu/drm/amd/display/dc/bios/bios_parser.c | 14 ++++++++++++++ + 1 file changed, 14 insertions(+) + +--- a/drivers/gpu/drm/amd/display/dc/bios/bios_parser.c ++++ b/drivers/gpu/drm/amd/display/dc/bios/bios_parser.c +@@ -664,6 +664,9 @@ static enum bp_result get_ss_info_v3_1( + + ss_table_header_include = GET_IMAGE(ATOM_ASIC_INTERNAL_SS_INFO_V3, + DATA_TABLES(ASIC_InternalSS_Info)); ++ if (!ss_table_header_include) ++ return BP_RESULT_UNSUPPORTED; ++ + table_size = + (le16_to_cpu(ss_table_header_include->sHeader.usStructureSize) + - sizeof(ATOM_COMMON_TABLE_HEADER)) +@@ -1031,6 +1034,8 @@ static enum bp_result get_ss_info_from_i + + header = GET_IMAGE(ATOM_ASIC_INTERNAL_SS_INFO_V2, + DATA_TABLES(ASIC_InternalSS_Info)); ++ if (!header) ++ return result; + + memset(info, 0, sizeof(struct spread_spectrum_info)); + +@@ -1104,6 +1109,8 @@ static enum bp_result get_ss_info_from_s + get_atom_data_table_revision(header, &revision); + + tbl = GET_IMAGE(ATOM_SPREAD_SPECTRUM_INFO, DATA_TABLES(SS_Info)); ++ if (!tbl) ++ return result; + + if (1 != revision.major || 2 > revision.minor) + return result; +@@ -1631,6 +1638,8 @@ static uint32_t get_ss_entry_number_from + + tbl = GET_IMAGE(ATOM_SPREAD_SPECTRUM_INFO, + DATA_TABLES(SS_Info)); ++ if (!tbl) ++ return number; + + if (1 != revision.major || 2 > revision.minor) + return number; +@@ -1711,6 +1720,8 @@ static uint32_t get_ss_entry_number_from + + header_include = GET_IMAGE(ATOM_ASIC_INTERNAL_SS_INFO_V2, + DATA_TABLES(ASIC_InternalSS_Info)); ++ if (!header_include) ++ return 0; + + size = (le16_to_cpu(header_include->sHeader.usStructureSize) + - sizeof(ATOM_COMMON_TABLE_HEADER)) +@@ -1748,6 +1759,9 @@ static uint32_t get_ss_entry_number_from + + header_include = GET_IMAGE(ATOM_ASIC_INTERNAL_SS_INFO_V3, + DATA_TABLES(ASIC_InternalSS_Info)); ++ if (!header_include) ++ return number; ++ + size = (le16_to_cpu(header_include->sHeader.usStructureSize) - + sizeof(ATOM_COMMON_TABLE_HEADER)) / + sizeof(ATOM_ASIC_SS_ASSIGNMENT_V3); diff --git a/queue-5.15/mmc-mtk-sd-fix-error-handle-of-probe-function.patch b/queue-5.15/mmc-mtk-sd-fix-error-handle-of-probe-function.patch new file mode 100644 index 00000000000..5911b3db03c --- /dev/null +++ b/queue-5.15/mmc-mtk-sd-fix-error-handle-of-probe-function.patch @@ -0,0 +1,81 @@ +From 291220451c775a054cedc4fab4578a1419eb6256 Mon Sep 17 00:00:00 2001 +From: Andy-ld Lu +Date: Thu, 7 Nov 2024 20:11:21 +0800 +Subject: mmc: mtk-sd: Fix error handle of probe function + +From: Andy-ld Lu + +commit 291220451c775a054cedc4fab4578a1419eb6256 upstream. + +In the probe function, it goes to 'release_mem' label and returns after +some procedure failure. But if the clocks (partial or all) have been +enabled previously, they would not be disabled in msdc_runtime_suspend, +since runtime PM is not yet enabled for this case. + +That cause mmc related clocks always on during system suspend and block +suspend flow. Below log is from a SDCard issue of MT8196 chromebook, it +returns -ETIMEOUT while polling clock stable in the msdc_ungate_clock() +and probe failed, but the enabled clocks could not be disabled anyway. + +[ 129.059253] clk_chk_dev_pm_suspend() +[ 129.350119] suspend warning: msdcpll is on +[ 129.354494] [ck_msdc30_1_sel : enabled, 1, 1, 191999939, ck_msdcpll_d2] +[ 129.362787] [ck_msdcpll_d2 : enabled, 1, 1, 191999939, msdcpll] +[ 129.371041] [ck_msdc30_1_ck : enabled, 1, 1, 191999939, ck_msdc30_1_sel] +[ 129.379295] [msdcpll : enabled, 1, 1, 383999878, clk26m] + +Add a new 'release_clk' label and reorder the error handle functions to +make sure the clocks be disabled after probe failure. + +Fixes: ffaea6ebfe9c ("mmc: mtk-sd: Use readl_poll_timeout instead of open-coded polling") +Fixes: 7a2fa8eed936 ("mmc: mtk-sd: use devm_mmc_alloc_host") +Signed-off-by: Andy-ld Lu +Reviewed-by: AngeloGioacchino Del Regno +Cc: stable@vger.kernel.org +Message-ID: <20241107121215.5201-1-andy-ld.lu@mediatek.com> +Signed-off-by: Ulf Hansson +Signed-off-by: Greg Kroah-Hartman +--- + drivers/mmc/host/mtk-sd.c | 9 +++++---- + 1 file changed, 5 insertions(+), 4 deletions(-) + +--- a/drivers/mmc/host/mtk-sd.c ++++ b/drivers/mmc/host/mtk-sd.c +@@ -2612,7 +2612,7 @@ static int msdc_drv_probe(struct platfor + ret = msdc_ungate_clock(host); + if (ret) { + dev_err(&pdev->dev, "Cannot ungate clocks!\n"); +- goto release_mem; ++ goto release_clk; + } + msdc_init_hw(host); + +@@ -2622,14 +2622,14 @@ static int msdc_drv_probe(struct platfor + GFP_KERNEL); + if (!host->cq_host) { + ret = -ENOMEM; +- goto host_free; ++ goto release; + } + host->cq_host->caps |= CQHCI_TASK_DESC_SZ_128; + host->cq_host->mmio = host->base + 0x800; + host->cq_host->ops = &msdc_cmdq_ops; + ret = cqhci_init(host->cq_host, mmc, true); + if (ret) +- goto host_free; ++ goto release; + mmc->max_segs = 128; + /* cqhci 16bit length */ + /* 0 size, means 65536 so we don't have to -1 here */ +@@ -2654,9 +2654,10 @@ static int msdc_drv_probe(struct platfor + end: + pm_runtime_disable(host->dev); + release: +- platform_set_drvdata(pdev, NULL); + msdc_deinit_hw(host); ++release_clk: + msdc_gate_clock(host); ++ platform_set_drvdata(pdev, NULL); + release_mem: + if (host->dma.gpd) + dma_free_coherent(&pdev->dev, diff --git a/queue-5.15/series b/queue-5.15/series index 8c430c6200c..0a94eeed964 100644 --- a/queue-5.15/series +++ b/queue-5.15/series @@ -475,7 +475,6 @@ timekeeping-always-check-for-negative-motion.patch media-uvcvideo-add-a-quirk-for-the-kaiweets-kti-w02-.patch media-cx231xx-add-support-for-dexatek-usb-video-grab.patch soc-imx8m-probe-the-soc-driver-as-platform-driver.patch -hid-bpf-fix-nkro-on-mistel-md770.patch drm-vc4-hvs-set-axi-panic-modes-for-the-hvs.patch drm-panel-orientation-quirks-add-quirk-for-aya-neo-2.patch drm-mcde-enable-module-autoloading.patch @@ -546,3 +545,5 @@ jffs2-fix-rtime-decompressor.patch mm-damon-vaddr-test-split-a-test-function-having-1024-bytes-frame-size.patch mm-damon-vaddr-fix-issue-in-damon_va_evenly_split_region.patch xhci-dbc-fix-stall-transfer-event-handling.patch +mmc-mtk-sd-fix-error-handle-of-probe-function.patch +drm-amd-display-check-bios-images-before-it-is-used.patch -- 2.47.3