All of lore.kernel.org
 help / color / mirror / Atom feed
From: Dan Carpenter <dan.carpenter@oracle.com>
To: linus.walleij@linaro.org
Cc: dri-devel@lists.freedesktop.org
Subject: [bug report] drm/tve200: Clean up panel bridging
Date: Fri, 1 Apr 2022 13:07:05 +0300	[thread overview]
Message-ID: <20220401100705.GB29860@kili> (raw)

[ Old code... ]

Hello Linus Walleij,

The patch 9ab12e88a0b4: "drm/tve200: Clean up panel bridging" from
Sep 11, 2017, leads to the following Smatch static checker warning:

	drivers/gpu/drm/tve200/tve200_drv.c:96 tve200_modeset_init()
	warn: missing error code here? '_dev_err()' failed. 'ret' = '0'

drivers/gpu/drm/tve200/tve200_drv.c
    62 static int tve200_modeset_init(struct drm_device *dev)
    63 {
    64         struct drm_mode_config *mode_config;
    65         struct tve200_drm_dev_private *priv = dev->dev_private;
    66         struct drm_panel *panel;
    67         struct drm_bridge *bridge;
    68         int ret = 0;
    69 
    70         drm_mode_config_init(dev);
    71         mode_config = &dev->mode_config;
    72         mode_config->funcs = &mode_config_funcs;
    73         mode_config->min_width = 352;
    74         mode_config->max_width = 720;
    75         mode_config->min_height = 240;
    76         mode_config->max_height = 576;
    77 
    78         ret = drm_of_find_panel_or_bridge(dev->dev->of_node,
    79                                           0, 0, &panel, &bridge);
    80         if (ret && ret != -ENODEV)
    81                 return ret;

There is a return check here.

    82         if (panel) {
    83                 bridge = drm_panel_bridge_add_typed(panel,
    84                                                     DRM_MODE_CONNECTOR_Unknown);
    85                 if (IS_ERR(bridge)) {
    86                         ret = PTR_ERR(bridge);
    87                         goto out_bridge;
    88                 }
    89         } else {
    90                 /*
    91                  * TODO: when we are using a different bridge than a panel
    92                  * (such as a dumb VGA connector) we need to devise a different
    93                  * method to get the connector out of the bridge.
    94                  */
    95                 dev_err(dev->dev, "the bridge is not a panel\n");
--> 96                 goto out_bridge;

From reading this code without looking deeply into the context it looks
like ret can be either 0 or -ENODEV.  Smatch does cross function
analysis (sometimes badly) and says that drm_of_find_panel_or_bridge()
only returns -EINVAL, zero, and -EPROBE_DEFER so it must be zero here.

    97         }
    98 
    99         ret = tve200_display_init(dev);
    100         if (ret) {
    101                 dev_err(dev->dev, "failed to init display\n");
    102                 goto out_bridge;
    103         }
    104 
    105         ret = drm_simple_display_pipe_attach_bridge(&priv->pipe,
    106                                                     bridge);
    107         if (ret) {
    108                 dev_err(dev->dev, "failed to attach bridge\n");
    109                 goto out_bridge;
    110         }
    111 
    112         priv->panel = panel;
    113         priv->connector = drm_panel_bridge_connector(bridge);
    114         priv->bridge = bridge;
    115 
    116         dev_info(dev->dev, "attached to panel %s\n",
    117                  dev_name(panel->dev));
    118 
    119         ret = drm_vblank_init(dev, 1);
    120         if (ret) {
    121                 dev_err(dev->dev, "failed to init vblank\n");
    122                 goto out_bridge;
    123         }
    124 
    125         drm_mode_config_reset(dev);
    126         drm_kms_helper_poll_init(dev);
    127 
    128         goto finish;
    129 
    130 out_bridge:
    131         if (panel)
    132                 drm_panel_bridge_remove(bridge);
    133         drm_mode_config_cleanup(dev);
    134 finish:
    135         return ret;
    136 }

regards,
dan carpenter

                 reply	other threads:[~2022-04-01 10:07 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

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=20220401100705.GB29860@kili \
    --to=dan.carpenter@oracle.com \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=linus.walleij@linaro.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 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.