[bug report] drm/bridge: anx7625: Add anx7625 MIPI DSI/DPI to DP

Dan Carpenter dan.carpenter at oracle.com
Wed Nov 17 13:47:20 UTC 2021


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


More information about the dri-devel mailing list