mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Sascha Hauer <s.hauer@pengutronix.de>
To: Martin Kaiser <martin@kaiser.cx>
Cc: b.zolnierkie@samsung.com, kernel@pengutronix.de,
	linux-fbdev@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH] video: imxfb: always allocate 256 entries for the color map
Date: Mon, 9 Jan 2017 13:59:42 +0100	[thread overview]
Message-ID: <20170109125942.tk6iutwdnzzxysix@pengutronix.de> (raw)
In-Reply-To: <1483395842-9675-1-git-send-email-martin@kaiser.cx>

On Mon, Jan 02, 2017 at 11:24:02PM +0100, Martin Kaiser wrote:
> The current code calculates the number of color map entries as
> 1 << info->var.bits_per_pixel. For 32bpp modes, 1 << 32 is 0 when
> written to an int variable. As a consequence, the subsequent copying
> of the default (non-empty) color map into our newly allocated color map
> fails and imxfb's probe function returns an error.
> 
> On both imx1 and imx21 platforms, the color map is used only for modes
> with <= 8bpp. By allocating 256 entries for the color map, we're on the
> safe side.
> 
> Signed-off-by: Martin Kaiser <martin@kaiser.cx>

Acked-by: Sascha Hauer <s.hauer@pengutronix.de>

Sascha

> ---
> Re-sending: corrected a typo in the LKML address, sorry for that.
> 
>  drivers/video/fbdev/imxfb.c |    6 +++++-
>  1 file changed, 5 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/video/fbdev/imxfb.c b/drivers/video/fbdev/imxfb.c
> index fe0c4ee..1b0faad 100644
> --- a/drivers/video/fbdev/imxfb.c
> +++ b/drivers/video/fbdev/imxfb.c
> @@ -985,7 +985,11 @@ static int imxfb_probe(struct platform_device *pdev)
>  	 */
>  	imxfb_check_var(&info->var, info);
>  
> -	ret = fb_alloc_cmap(&info->cmap, 1 << info->var.bits_per_pixel, 0);
> +	/*
> +	 * For modes > 8bpp, the color map is bypassed.
> +	 * Therefore, 256 entries are enough.
> +	 */
> +	ret = fb_alloc_cmap(&info->cmap, 256, 0);
>  	if (ret < 0)
>  		goto failed_cmap;
>  
> -- 
> 1.7.10.4
> 
> 
> 

-- 
Pengutronix e.K.                           |                             |
Industrial Linux Solutions                 | http://www.pengutronix.de/  |
Peiner Str. 6-8, 31137 Hildesheim, Germany | Phone: +49-5121-206917-0    |
Amtsgericht Hildesheim, HRA 2686           | Fax:   +49-5121-206917-5555 |

  reply	other threads:[~2017-01-09 12:59 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <1483395604-6931-1-git-send-email-martin@kaiser.cx>
2017-01-02 22:24 ` Martin Kaiser
2017-01-09 12:59   ` Sascha Hauer [this message]
2017-01-11 14:29     ` Bartlomiej Zolnierkiewicz

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=20170109125942.tk6iutwdnzzxysix@pengutronix.de \
    --to=s.hauer@pengutronix.de \
    --cc=b.zolnierkie@samsung.com \
    --cc=kernel@pengutronix.de \
    --cc=linux-fbdev@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=martin@kaiser.cx \
    /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

all inboxes | Powered by JetHome®