From: "Ondřej Jirman" <megous@megous.com>
To: "Jernej Škrabec" <jernej.skrabec@gmail.com>
Cc: David Airlie <airlied@linux.ie>, Chen-Yu Tsai <wens@csie.org>,
"open list:DRM DRIVERS FOR ALLWINNER A10"
<dri-devel@lists.freedesktop.org>,
open list <linux-kernel@vger.kernel.org>,
linux-sunxi@googlegroups.com, Maxime Ripard <mripard@kernel.org>,
Daniel Vetter <daniel@ffwll.ch>,
"moderated list:ARM/Allwinner sunXi SoC support"
<linux-arm-kernel@lists.infradead.org>
Subject: Re: [linux-sunxi] [PATCH] drm/sun4i: Fix dsi dcs long write function
Date: Fri, 28 Aug 2020 14:51:24 +0200 [thread overview]
Message-ID: <20200828125124.mgqforbmrjjee7gj@core.my.home> (raw)
In-Reply-To: <1872601.C7yQfbK89F@jernej-laptop>
On Fri, Aug 28, 2020 at 02:35:26PM +0200, Jernej Škrabec wrote:
> Dne petek, 28. avgust 2020 ob 13:24:44 CEST je Ondrej Jirman napisal(a):
> > It's writing too much data. regmap_bulk_write expects number of
> > register sized chunks to write, not a byte sized length of the
> > bounce buffer. Bounce buffer needs to be padded too, so that
> > regmap_bulk_write will not read past the end of the buffer.
> >
> > Signed-off-by: Ondrej Jirman <megous@megous.com>
>
> Fixes: 133add5b5ad4 ("drm/sun4i: Add Allwinner A31 MIPI-DSI controller
> support")
It doesn't really fix anything user visible though, and will not help
the stable branch in any way. It just makes the code more correct.
Though now that you came up with the tag, copypasting it is not that much
work. ;) So I added it.
> should be added. Fix will be then automatically picked into stable releases.
>
> Small nit below.
>
> > ---
> > drivers/gpu/drm/sun4i/sun6i_mipi_dsi.c | 4 ++--
> > 1 file changed, 2 insertions(+), 2 deletions(-)
> >
> > diff --git a/drivers/gpu/drm/sun4i/sun6i_mipi_dsi.c
> > b/drivers/gpu/drm/sun4i/sun6i_mipi_dsi.c index 7f13f4d715bf..840fad1b68dd
> > 100644
> > --- a/drivers/gpu/drm/sun4i/sun6i_mipi_dsi.c
> > +++ b/drivers/gpu/drm/sun4i/sun6i_mipi_dsi.c
> > @@ -889,7 +889,7 @@ static int sun6i_dsi_dcs_write_long(struct sun6i_dsi
> > *dsi, regmap_write(dsi->regs, SUN6I_DSI_CMD_TX_REG(0),
> > sun6i_dsi_dcs_build_pkt_hdr(dsi, msg));
> >
> > - bounce = kzalloc(msg->tx_len + sizeof(crc), GFP_KERNEL);
> > + bounce = kzalloc(msg->tx_len + sizeof(crc) + 3, GFP_KERNEL);
>
> It would be nicer to use ALIGN() macro, but I'm fine either way.
Nice idea.
> Reviewed-by: Jernej Skrabec <jernej.skrabec@siol.net>
Thanks. :)
regards,
o.
> Best regards,
> Jernej
>
> > if (!bounce)
> > return -ENOMEM;
> >
> > @@ -900,7 +900,7 @@ static int sun6i_dsi_dcs_write_long(struct sun6i_dsi
> > *dsi, memcpy((u8 *)bounce + msg->tx_len, &crc, sizeof(crc));
> > len += sizeof(crc);
> >
> > - regmap_bulk_write(dsi->regs, SUN6I_DSI_CMD_TX_REG(1), bounce,
> len);
> > + regmap_bulk_write(dsi->regs, SUN6I_DSI_CMD_TX_REG(1), bounce,
> > DIV_ROUND_UP(len, 4)); regmap_write(dsi->regs, SUN6I_DSI_CMD_CTL_REG, len +
> > 4 - 1);
> > kfree(bounce);
>
>
>
>
_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
prev parent reply other threads:[~2020-08-28 12:52 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-08-28 11:24 [PATCH] drm/sun4i: Fix dsi dcs long write function Ondrej Jirman
2020-08-28 12:35 ` [linux-sunxi] " Jernej Škrabec
2020-08-28 12:51 ` Ondřej Jirman [this message]
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=20200828125124.mgqforbmrjjee7gj@core.my.home \
--to=megous@megous.com \
--cc=airlied@linux.ie \
--cc=daniel@ffwll.ch \
--cc=dri-devel@lists.freedesktop.org \
--cc=jernej.skrabec@gmail.com \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-sunxi@googlegroups.com \
--cc=mripard@kernel.org \
--cc=wens@csie.org \
/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