From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 688FA2676CF; Tue, 8 Apr 2025 12:13:57 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1744114437; cv=none; b=NYGp/CB5hL0vlaI+cDHycDbXSTqbLkf3nDAMcj4AUA5E+/OuApWexzCboGbH5QJ9TO1bhDhrWVvV1lq1ispGwdLkicGu0V0fRHYQsLxuf2tMKyYtHp3RKmxEgnh/YAYluoWxAFza0PkAEkmPWIwtFM6aGf8u9dHwqiPuYt8WQbo= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1744114437; c=relaxed/simple; bh=9O0axqpkjJwy0pZctLhmWYytz+zNgJQGsQbxLVt5jeM=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=CX03ir6kMurQPtWq1ifY8CyMVTdUMqwlK1Zvx/TGF0o9UdIyrGFlQVrChQYGM4B3cob+rvWfXJ6JqONkFUf1/jMH2melaK4TSN5pIXUZSmxQGOxxuBsMui62HwjrvpJAgZJ45wah4cHV8+HC7ZOvi6DF01yRWNwY22yrSvzFjwk= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b=Ugf2lli9; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b="Ugf2lli9" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 941ADC4CEE5; Tue, 8 Apr 2025 12:13:56 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1744114436; bh=9O0axqpkjJwy0pZctLhmWYytz+zNgJQGsQbxLVt5jeM=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Ugf2lli9bY5X0vHdWCB4rTnhlbctr/BDBKQoAeKBu2Nozt92UHsoPOXHXIPjxz/xU GNLoRbdoNMOh6PVHRYmI6ImMXFiYuHNLnraOcmyMP+zuwIdXH/++akEvweyDs5+1nF e5dt6SR5Tv+qT12+1mY32nGWbEX7n53XMLMLpA/o= From: Greg Kroah-Hartman To: stable@vger.kernel.org Cc: Greg Kroah-Hartman , patches@lists.linux.dev, kernel test robot , Dan Carpenter , Mattijs Korpershoek , AngeloGioacchino Del Regno , CK Hu , Chun-Kuang Hu , Sasha Levin Subject: [PATCH 6.13 106/499] drm/mediatek: dsi: fix error codes in mtk_dsi_host_transfer() Date: Tue, 8 Apr 2025 12:45:18 +0200 Message-ID: <20250408104853.852264665@linuxfoundation.org> X-Mailer: git-send-email 2.49.0 In-Reply-To: <20250408104851.256868745@linuxfoundation.org> References: <20250408104851.256868745@linuxfoundation.org> User-Agent: quilt/0.68 X-stable: review X-Patchwork-Hint: ignore Precedence: bulk X-Mailing-List: stable@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit 6.13-stable review patch. If anyone has any objections, please let me know. ------------------ From: Dan Carpenter [ Upstream commit dcb166ee43c3d594e7b73a24f6e8cf5663eeff2c ] 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. Fixes: 81cc7e51c4f1 ("drm/mediatek: Allow commands to be sent during video mode") Reported-by: kernel test robot Closes: https://lore.kernel.org/r/202412210801.iADw0oIH-lkp@intel.com/ Signed-off-by: Dan Carpenter Reviewed-by: Mattijs Korpershoek Reviewed-by: AngeloGioacchino Del Regno Reviewed-by: CK Hu Link: https://patchwork.kernel.org/project/dri-devel/patch/b754a408-4f39-4e37-b52d-7706c132e27f@stanley.mountain/ Signed-off-by: Chun-Kuang Hu Signed-off-by: Sasha Levin --- 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 40752f2320548..852aeef9f38dc 100644 --- a/drivers/gpu/drm/mediatek/mtk_dsi.c +++ b/drivers/gpu/drm/mediatek/mtk_dsi.c @@ -1116,12 +1116,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) { @@ -1170,7 +1170,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.39.5