[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <CAAOTY_9xrt_ku-fZotJAnPa2ns-2PCGken4TepMrQYG9KEJcFA@mail.gmail.com>
Date: Fri, 8 Dec 2023 07:54:00 +0800
From: Chun-Kuang Hu <chunkuang.hu@...nel.org>
To: Michael Walle <mwalle@...nel.org>
Cc: Nícolas F . R . A . Prado
<nfraprado@...labora.com>, Chun-Kuang Hu <chunkuang.hu@...nel.org>,
Philipp Zabel <p.zabel@...gutronix.de>,
David Airlie <airlied@...il.com>,
Daniel Vetter <daniel@...ll.ch>,
Matthias Brugger <matthias.bgg@...il.com>,
AngeloGioacchino Del Regno
<angelogioacchino.delregno@...labora.com>,
"Nancy . Lin" <nancy.lin@...iatek.com>,
Frank Wunderlich <frank-w@...lic-files.de>,
Jitao Shi <jitao.shi@...iatek.com>,
Stu Hsieh <stu.hsieh@...iatek.com>,
dri-devel@...ts.freedesktop.org,
linux-mediatek@...ts.infradead.org, linux-kernel@...r.kernel.org,
linux-arm-kernel@...ts.infradead.org
Subject: Re: [PATCH v4 1/2] drm/mediatek: fix kernel oops if no crtc is found
Hi, Michael:
Michael Walle <mwalle@...nel.org> 於 2023年9月5日 週二 下午4:49寫道:
>
> drm_crtc_from_index(0) might return NULL if there are no CRTCs
> registered at all which will lead to a kernel oops in
> mtk_drm_crtc_dma_dev_get(). Add the missing return value check.
Applied to mediatek-drm-fixes [1], thanks.
[1] https://git.kernel.org/pub/scm/linux/kernel/git/chunkuang.hu/linux.git/log/?h=mediatek-drm-fixes
Regards,
Chun-Kuang.
>
> Fixes: 0d9eee9118b7 ("drm/mediatek: Add drm ovl_adaptor sub driver for MT8195")
> Signed-off-by: Michael Walle <mwalle@...nel.org>
> Reviewed-by: Nícolas F. R. A. Prado <nfraprado@...labora.com>
> Tested-by: Nícolas F. R. A. Prado <nfraprado@...labora.com>
> Reviewed-by: AngeloGioacchino Del Regno <angelogioacchino.delregno@...labora.com>
> ---
> v4:
> - collected tags
> v3:
> - none
> v2:
> - collected tags
> - fixed typos
> ---
> drivers/gpu/drm/mediatek/mtk_drm_drv.c | 5 ++++-
> 1 file changed, 4 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/gpu/drm/mediatek/mtk_drm_drv.c b/drivers/gpu/drm/mediatek/mtk_drm_drv.c
> index 93552d76b6e7..2c582498817e 100644
> --- a/drivers/gpu/drm/mediatek/mtk_drm_drv.c
> +++ b/drivers/gpu/drm/mediatek/mtk_drm_drv.c
> @@ -420,6 +420,7 @@ static int mtk_drm_kms_init(struct drm_device *drm)
> struct mtk_drm_private *private = drm->dev_private;
> struct mtk_drm_private *priv_n;
> struct device *dma_dev = NULL;
> + struct drm_crtc *crtc;
> int ret, i, j;
>
> if (drm_firmware_drivers_only())
> @@ -494,7 +495,9 @@ static int mtk_drm_kms_init(struct drm_device *drm)
> }
>
> /* Use OVL device for all DMA memory allocations */
> - dma_dev = mtk_drm_crtc_dma_dev_get(drm_crtc_from_index(drm, 0));
> + crtc = drm_crtc_from_index(drm, 0);
> + if (crtc)
> + dma_dev = mtk_drm_crtc_dma_dev_get(crtc);
> if (!dma_dev) {
> ret = -ENODEV;
> dev_err(drm->dev, "Need at least one OVL device\n");
> --
> 2.39.2
>
Powered by blists - more mailing lists