All of lore.kernel.org
 help / color / mirror / Atom feed
* [bug report] drm/bridge: anx7625: Add anx7625 MIPI DSI/DPI to DP
@ 2021-11-17 13:47 Dan Carpenter
  2021-11-18  2:54 ` Xin Ji
  0 siblings, 1 reply; 2+ messages in thread
From: Dan Carpenter @ 2021-11-17 13:47 UTC (permalink / raw)
  To: xji; +Cc: dri-devel

Hello Xin Ji,

The patch 8bdfc5dae4e3: "drm/bridge: anx7625: Add anx7625 MIPI
DSI/DPI to DP" from Sep 18, 2020, leads to the following Smatch
static checker warning:

	drivers/gpu/drm/bridge/analogix/anx7625.c:1050 anx7625_init_gpio()
	warn: 'platform->pdata.gpio_p_on' could be an error pointer

	drivers/gpu/drm/bridge/analogix/anx7625.c:1050 anx7625_init_gpio()
	warn: 'platform->pdata.gpio_reset' could be an error pointer

drivers/gpu/drm/bridge/analogix/anx7625.c
    1037 static void anx7625_init_gpio(struct anx7625_data *platform)
    1038 {
    1039         struct device *dev = &platform->client->dev;
    1040 
    1041         DRM_DEV_DEBUG_DRIVER(dev, "init gpio\n");
    1042 
    1043         /* Gpio for chip power enable */
    1044         platform->pdata.gpio_p_on =
    1045                 devm_gpiod_get_optional(dev, "enable", GPIOD_OUT_LOW);
    1046         /* Gpio for chip reset */
    1047         platform->pdata.gpio_reset =
    1048                 devm_gpiod_get_optional(dev, "reset", GPIOD_OUT_LOW);
    1049 
--> 1050         if (platform->pdata.gpio_p_on && platform->pdata.gpio_reset) {
    1051                 platform->pdata.low_power_mode = 1;
    1052                 DRM_DEV_DEBUG_DRIVER(dev, "low power mode, pon %d, reset %d.\n",
    1053                                      desc_to_gpio(platform->pdata.gpio_p_on),
                                                           ^^^^^^^^^^^^^^^^^^^^^^^^^
    1054                                      desc_to_gpio(platform->pdata.gpio_reset));
                                                           ^^^^^^^^^^^^^^^^^^^^^^^^^^
This will crash here but only when there is an error and debugging is
enabled.

    1055         } else {
    1056                 platform->pdata.low_power_mode = 0;
    1057                 DRM_DEV_DEBUG_DRIVER(dev, "not low power mode.\n");
    1058         }
    1059 }

regards,
dan carpenter

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [bug report] drm/bridge: anx7625: Add anx7625 MIPI DSI/DPI to DP
  2021-11-17 13:47 [bug report] drm/bridge: anx7625: Add anx7625 MIPI DSI/DPI to DP Dan Carpenter
@ 2021-11-18  2:54 ` Xin Ji
  0 siblings, 0 replies; 2+ messages in thread
From: Xin Ji @ 2021-11-18  2:54 UTC (permalink / raw)
  To: Dan Carpenter; +Cc: bliang, dri-devel

On Wed, Nov 17, 2021 at 04:47:20PM +0300, Dan Carpenter wrote:
> Hello Xin Ji,
> 
> The patch 8bdfc5dae4e3: "drm/bridge: anx7625: Add anx7625 MIPI
> DSI/DPI to DP" from Sep 18, 2020, leads to the following Smatch
> static checker warning:
> 
> 	drivers/gpu/drm/bridge/analogix/anx7625.c:1050 anx7625_init_gpio()
> 	warn: 'platform->pdata.gpio_p_on' could be an error pointer
> 
> 	drivers/gpu/drm/bridge/analogix/anx7625.c:1050 anx7625_init_gpio()
> 	warn: 'platform->pdata.gpio_reset' could be an error pointer

Hi Dan Carpenter, thanks for the report, I'll upstream a patch to fix it.

Thanks,
Xin
> 
> drivers/gpu/drm/bridge/analogix/anx7625.c
>     1037 static void anx7625_init_gpio(struct anx7625_data *platform)
>     1038 {
>     1039         struct device *dev = &platform->client->dev;
>     1040 
>     1041         DRM_DEV_DEBUG_DRIVER(dev, "init gpio\n");
>     1042 
>     1043         /* Gpio for chip power enable */
>     1044         platform->pdata.gpio_p_on =
>     1045                 devm_gpiod_get_optional(dev, "enable", GPIOD_OUT_LOW);
>     1046         /* Gpio for chip reset */
>     1047         platform->pdata.gpio_reset =
>     1048                 devm_gpiod_get_optional(dev, "reset", GPIOD_OUT_LOW);
>     1049 
> --> 1050         if (platform->pdata.gpio_p_on && platform->pdata.gpio_reset) {
>     1051                 platform->pdata.low_power_mode = 1;
>     1052                 DRM_DEV_DEBUG_DRIVER(dev, "low power mode, pon %d, reset %d.\n",
>     1053                                      desc_to_gpio(platform->pdata.gpio_p_on),
>                                                            ^^^^^^^^^^^^^^^^^^^^^^^^^
>     1054                                      desc_to_gpio(platform->pdata.gpio_reset));
>                                                            ^^^^^^^^^^^^^^^^^^^^^^^^^^
> This will crash here but only when there is an error and debugging is
> enabled.
> 
>     1055         } else {
>     1056                 platform->pdata.low_power_mode = 0;
>     1057                 DRM_DEV_DEBUG_DRIVER(dev, "not low power mode.\n");
>     1058         }
>     1059 }
> 
> regards,
> dan carpenter

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2021-11-18  2:54 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-11-17 13:47 [bug report] drm/bridge: anx7625: Add anx7625 MIPI DSI/DPI to DP Dan Carpenter
2021-11-18  2:54 ` Xin Ji

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.