From: "CK Hu (胡俊光)" <ck.hu@mediatek.com>
To: Julien Stephan <jstephan@baylibre.com>,
"dan.carpenter@linaro.org" <dan.carpenter@linaro.org>
Cc: "kernel-janitors@vger.kernel.org"
<kernel-janitors@vger.kernel.org>,
"chunkuang.hu@kernel.org" <chunkuang.hu@kernel.org>,
"mkorpershoek@baylibre.com" <mkorpershoek@baylibre.com>,
"AngeloGioacchino Del Regno"
<angelogioacchino.delregno@collabora.com>,
"dri-devel@lists.freedesktop.org"
<dri-devel@lists.freedesktop.org>,
"airlied@gmail.com" <airlied@gmail.com>,
"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
"linux-arm-kernel@lists.infradead.org"
<linux-arm-kernel@lists.infradead.org>,
"p.zabel@pengutronix.de" <p.zabel@pengutronix.de>,
"matthias.bgg@gmail.com" <matthias.bgg@gmail.com>,
"daniel@ffwll.ch" <daniel@ffwll.ch>,
"linux-mediatek@lists.infradead.org"
<linux-mediatek@lists.infradead.org>
Subject: Re: [PATCH RESEND] drm/mediatek: dsi: fix error codes in mtk_dsi_host_transfer()
Date: Mon, 17 Feb 2025 09:00:43 +0000 [thread overview]
Message-ID: <6d6bf950d7a2b611f215cb52e4aa3e6aa9c51282.camel@mediatek.com> (raw)
In-Reply-To: <b754a408-4f39-4e37-b52d-7706c132e27f@stanley.mountain>
On Wed, 2025-01-08 at 12:35 +0300, Dan Carpenter wrote:
> External email : Please do not click links or open attachments until you have verified the sender or the content.
>
>
> There is a type bug because the return statement:
>
> return ret < 0 ? ret : recv_cnt;
>
> The issue is that ret is an int, recv_cnt is a u32 and the function
> returns ssize_t, which is a signed long. The way that the type promotion
> works is that the negative error codes are first cast to u32 and then
> to signed long. The error codes end up being positive instead of
> negative and the callers treat them as success.
Reviewed-by: CK Hu <ck.hu@mediatek.com>
>
> Fixes: 81cc7e51c4f1 ("drm/mediatek: Allow commands to be sent during video mode")
> Reported-by: kernel test robot <lkp@intel.com>
> Closes: https://lore.kernel.org/r/202412210801.iADw0oIH-lkp@intel.com/
> Signed-off-by: Dan Carpenter <dan.carpenter@linaro.org>
> Reviewed-by: Mattijs Korpershoek <mkorpershoek@baylibre.com>
> Reviewed-by: AngeloGioacchino Del Regno <angelogioacchino.delregno@collabora.com>
> ---
> I sent this patch earlier:
> https://lore.kernel.org/all/Y%2FyBC4yxTs+Po0TG@kili/
> but it wasn't applied. I've changed the commit message a bit and added
> new tags.
>
> drivers/gpu/drm/mediatek/mtk_dsi.c | 6 +++---
> 1 file changed, 3 insertions(+), 3 deletions(-)
>
> diff --git a/drivers/gpu/drm/mediatek/mtk_dsi.c b/drivers/gpu/drm/mediatek/mtk_dsi.c
> index d871b1dba083..0acfda47f002 100644
> --- a/drivers/gpu/drm/mediatek/mtk_dsi.c
> +++ b/drivers/gpu/drm/mediatek/mtk_dsi.c
> @@ -1015,12 +1015,12 @@ static ssize_t mtk_dsi_host_transfer(struct mipi_dsi_host *host,
> const struct mipi_dsi_msg *msg)
> {
> struct mtk_dsi *dsi = host_to_dsi(host);
> - u32 recv_cnt, i;
> + ssize_t recv_cnt;
> u8 read_data[16];
> void *src_addr;
> u8 irq_flag = CMD_DONE_INT_FLAG;
> u32 dsi_mode;
> - int ret;
> + int ret, i;
>
> dsi_mode = readl(dsi->regs + DSI_MODE_CTRL);
> if (dsi_mode & MODE) {
> @@ -1069,7 +1069,7 @@ static ssize_t mtk_dsi_host_transfer(struct mipi_dsi_host *host,
> if (recv_cnt)
> memcpy(msg->rx_buf, src_addr, recv_cnt);
>
> - DRM_INFO("dsi get %d byte data from the panel address(0x%x)\n",
> + DRM_INFO("dsi get %zd byte data from the panel address(0x%x)\n",
> recv_cnt, *((u8 *)(msg->tx_buf)));
>
> restore_dsi_mode:
> --
> 2.45.2
>
>
next prev parent reply other threads:[~2025-02-17 10:53 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-01-08 9:35 [PATCH RESEND] drm/mediatek: dsi: fix error codes in mtk_dsi_host_transfer() Dan Carpenter
2025-02-17 9:00 ` CK Hu (胡俊光) [this message]
2025-03-03 13:29 ` Chun-Kuang Hu
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=6d6bf950d7a2b611f215cb52e4aa3e6aa9c51282.camel@mediatek.com \
--to=ck.hu@mediatek.com \
--cc=airlied@gmail.com \
--cc=angelogioacchino.delregno@collabora.com \
--cc=chunkuang.hu@kernel.org \
--cc=dan.carpenter@linaro.org \
--cc=daniel@ffwll.ch \
--cc=dri-devel@lists.freedesktop.org \
--cc=jstephan@baylibre.com \
--cc=kernel-janitors@vger.kernel.org \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mediatek@lists.infradead.org \
--cc=matthias.bgg@gmail.com \
--cc=mkorpershoek@baylibre.com \
--cc=p.zabel@pengutronix.de \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox