Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1381409 > unrolled thread

Re: [PATCH] omapfb: panel-sharp-ls037v7dw01: fix check of gpio_to_desc() return value

Started byTomi Valkeinen <tomi.valkeinen@ti.com>
First post2016-04-18 11:30 +0200
Last post2016-04-18 11:30 +0200
Articles 1 — 1 participant

Back to article view | Back to linux.kernel

This discussion starts older than the indexed window; earlier articles aren't shown. The article labeled Started by below is the oldest one visible, not the original post.


Contents

  Re: [PATCH] omapfb: panel-sharp-ls037v7dw01: fix check of  gpio_to_desc() return value Tomi Valkeinen <tomi.valkeinen@ti.com> - 2016-04-18 11:30 +0200

#1381409 — Re: [PATCH] omapfb: panel-sharp-ls037v7dw01: fix check of gpio_to_desc() return value

FromTomi Valkeinen <tomi.valkeinen@ti.com>
Date2016-04-18 11:30 +0200
SubjectRe: [PATCH] omapfb: panel-sharp-ls037v7dw01: fix check of gpio_to_desc() return value
Message-ID<rpdFh-32l-13@gated-at.bofh.it>

[Multipart message — attachments visible in raw view] — view raw

On 23/03/16 00:51, Vladimir Zapolskiy wrote:
> The change fixes a check of gpio_to_desc() return value, the function
> returns either a valid pointer to struct gpio_desc or NULL, this makes
> IS_ERR() check invalid and may lead to a NULL pointer dereference in
> runtime.
> 
> Signed-off-by: Vladimir Zapolskiy <vz@mleia.com>
> ---
>  .../fbdev/omap2/omapfb/displays/panel-sharp-ls037v7dw01.c    | 12 ++++--------
>  1 file changed, 4 insertions(+), 8 deletions(-)
> 
> diff --git a/drivers/video/fbdev/omap2/omapfb/displays/panel-sharp-ls037v7dw01.c b/drivers/video/fbdev/omap2/omapfb/displays/panel-sharp-ls037v7dw01.c
> index abfd1f6..1954ec9 100644
> --- a/drivers/video/fbdev/omap2/omapfb/displays/panel-sharp-ls037v7dw01.c
> +++ b/drivers/video/fbdev/omap2/omapfb/displays/panel-sharp-ls037v7dw01.c
> @@ -200,20 +200,16 @@ static struct omap_dss_driver sharp_ls_ops = {
>  static int sharp_ls_get_gpio(struct device *dev, int gpio, unsigned long flags,
>  		  char *desc, struct gpio_desc **gpiod)
>  {
> -	struct gpio_desc *gd;
>  	int r;
>  
> -	*gpiod = NULL;
> -
>  	r = devm_gpio_request_one(dev, gpio, flags, desc);
> -	if (r)
> +	if (r) {
> +		*gpiod = NULL;
>  		return r == -ENOENT ? 0 : r;
> +	}
>  
> -	gd = gpio_to_desc(gpio);
> -	if (IS_ERR(gd))
> -		return PTR_ERR(gd) == -ENOENT ? 0 : PTR_ERR(gd);
> +	*gpiod = gpio_to_desc(gpio);
>  
> -	*gpiod = gd;
>  	return 0;
>  }
>  
> 

Thanks, queued for 4.6 fixes.

 Tomi

[toc] | [standalone]


Back to top | Article view | linux.kernel


csiph-web