Received: by 2002:a05:6358:4e97:b0:b3:742d:4702 with SMTP id ce23csp3116642rwb; Mon, 15 Aug 2022 18:31:22 -0700 (PDT) X-Google-Smtp-Source: AA6agR5TkaizACYGKqdJ2v+VZQO7A4HEaWsOR/nmmwkgtSVMxqXJ5AXve5k0T8+61+NUFLDQi1yI X-Received: by 2002:a05:6a00:1907:b0:534:f2ef:e8fe with SMTP id y7-20020a056a00190700b00534f2efe8femr5951826pfi.65.1660613482523; Mon, 15 Aug 2022 18:31:22 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1660613482; cv=none; d=google.com; s=arc-20160816; b=Ta37RybYsHII4MkzzUBlzyY/grZIfSlW/9mFHnBbJFe0eNgTETe+tLXwcTN6hpqeIv m+M1S48sNgxOJ3kGL+gTxxsKUpTLhyz55KVFjfYMbniwL3rfPrJtEO4vy/mYKb1l+SoO wu6AYKZxRvbDIhZYcyfoDkQgKMfaArehvKo+8WfHlTnu0UO2otgbB1STOdCfuWGpnyI8 wlle6Ux54ev9hvVIZm2uCFX/6XxhsLJ90m12SUueRN5e71GTGWex/ZShG2T/s9R4IqX9 NGVKgInurhLAs1Qz6lYGONDHu817Yocz5VEq3VOeC8fi7rNlXYVYLrywFucRettZt+7P s9aQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=gD4IZNs8wQpqroe8Db/B0DthfFWv3GBtVkvZ+sG/Y8Y=; b=sJcCI+jtHjIzbL4GcmX8aiForEOXkFGeGPQ7ZOVkRMDiQgJ3ZpQ/ELldfvSe1vBEtl V7EmDnrI6zvl1/Wxea4BwmDCP2hf2gKdkCv9IMASUdydTsGBWVWOT42OxEVuJDNQglSR mUsyyo0cFZ5DSsCPc27W4H7ZYInbsXfviZYmd7MNyBR2bj+hOS4QKBEXs12LhhQEyWJm E6Y+Ab3OBMCoWWz9a/KGcI6Bo8YgB88nKYJ88OOdwTkUkhupWu5h4S3ptlFA887uPb2o UAQtrm7oEnNV2X3kBKLJyRdM5r+/dB/eszv+C60OtrsEsNO+3RobDp2WvlYXmv6Q2bW5 0QhQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=fHQr2UII; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id d20-20020a170902729400b001713d5d096esi12528207pll.14.2022.08.15.18.31.11; Mon, 15 Aug 2022 18:31:22 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=fHQr2UII; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1345467AbiHOXVC (ORCPT + 99 others); Mon, 15 Aug 2022 19:21:02 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:48328 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1353474AbiHOXQh (ORCPT ); Mon, 15 Aug 2022 19:16:37 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 16A391484E5; Mon, 15 Aug 2022 13:03:21 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 62B38B81142; Mon, 15 Aug 2022 20:03:20 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id A51EDC433C1; Mon, 15 Aug 2022 20:03:18 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660593799; bh=VBA4o0Mb7y8Az4iYRvFH18ZYSc8JyfxdBkwdZbQ+Q28=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=fHQr2UIIzKmFK6xp8m92rXfJQn8Eg8mgajLq2iPdk6Qo1dNM+sImHdgs8lU09fLVJ kb1EA9LnptXG89CsJ4LlvrLNxKkq55Mx+jjQXGhmgVhL7Kn4e6X5T702D5JPrT6IWh aATqMwjex6tVJEskTLOlgNOaDzIGDGPg7QdE89uk= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Yunhao Tian , =?UTF-8?q?Noralf=20Tr=C3=B8nnes?= , Sasha Levin Subject: [PATCH 5.19 0327/1157] drm/mipi-dbi: align max_chunk to 2 in spi_transfer Date: Mon, 15 Aug 2022 19:54:43 +0200 Message-Id: <20220815180452.735746838@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180439.416659447@linuxfoundation.org> References: <20220815180439.416659447@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-7.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Yunhao Tian [ Upstream commit 435c249008cba04ed6a7975e9411f3b934620204 ] In __spi_validate, there's a validation that no partial transfers are accepted (xfer->len % w_size must be zero). When max_chunk is not a multiple of bpw (e.g. max_chunk = 65535, bpw = 16), the transfer will be rejected. This patch aligns max_chunk to 2 bytes (the maximum value of bpw is 16), so that no partial transfer will occur. Fixes: d23d4d4dac01 ("drm/tinydrm: Move tinydrm_spi_transfer()") Signed-off-by: Yunhao Tian Signed-off-by: Noralf Trønnes Link: https://patchwork.freedesktop.org/patch/msgid/20220510030219.2486687-1-t123yh.xyz@gmail.com Signed-off-by: Sasha Levin --- drivers/gpu/drm/drm_mipi_dbi.c | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/drivers/gpu/drm/drm_mipi_dbi.c b/drivers/gpu/drm/drm_mipi_dbi.c index 9314f2ead79f..09e4edb5a992 100644 --- a/drivers/gpu/drm/drm_mipi_dbi.c +++ b/drivers/gpu/drm/drm_mipi_dbi.c @@ -1199,6 +1199,13 @@ int mipi_dbi_spi_transfer(struct spi_device *spi, u32 speed_hz, size_t chunk; int ret; + /* In __spi_validate, there's a validation that no partial transfers + * are accepted (xfer->len % w_size must be zero). + * Here we align max_chunk to multiple of 2 (16bits), + * to prevent transfers from being rejected. + */ + max_chunk = ALIGN_DOWN(max_chunk, 2); + spi_message_init_with_transfers(&m, &tr, 1); while (len) { -- 2.35.1