All of lore.kernel.org
 help / color / mirror / Atom feed
From: Dan Carpenter <dan.carpenter@oracle.com>
To: treapking@chromium.org
Cc: dri-devel@lists.freedesktop.org
Subject: [bug report] drm/bridge: it6505: Adapt runtime power management framework
Date: Tue, 25 Oct 2022 14:44:10 +0300	[thread overview]
Message-ID: <Y1fMCs6VnxbDcB41@kili> (raw)

Hello Pin-yen Lin,

The patch 10517777d302: "drm/bridge: it6505: Adapt runtime power
management framework" from Oct 4, 2022, leads to the following Smatch
static checker warning:

	drivers/gpu/drm/bridge/ite-it6505.c:2712 it6505_extcon_work()
	warn: pm_runtime_get_sync() also returns 1 on success

drivers/gpu/drm/bridge/ite-it6505.c
    2685 static void it6505_extcon_work(struct work_struct *work)
    2686 {
    2687         struct it6505 *it6505 = container_of(work, struct it6505, extcon_wq);
    2688         struct device *dev = &it6505->client->dev;
    2689         int state, ret;
    2690 
    2691         if (it6505->enable_drv_hold)
    2692                 return;
    2693 
    2694         mutex_lock(&it6505->extcon_lock);
    2695 
    2696         state = extcon_get_state(it6505->extcon, EXTCON_DISP_DP);
    2697         DRM_DEV_DEBUG_DRIVER(dev, "EXTCON_DISP_DP = 0x%02x", state);
    2698 
    2699         if (state == it6505->extcon_state || unlikely(state < 0))
    2700                 goto unlock;
    2701         it6505->extcon_state = state;
    2702         if (state) {
    2703                 DRM_DEV_DEBUG_DRIVER(dev, "start to power on");
    2704                 msleep(100);
    2705                 ret = pm_runtime_get_sync(dev);
    2706 
    2707                 /*
    2708                  * On system resume, extcon_work can be triggered before
    2709                  * pm_runtime_force_resume re-enables runtime power management.
    2710                  * Handling the error here to make sure the bridge is powered on.
    2711                  */
--> 2712                 if (ret)
    2713                         it6505_poweron(it6505);

pm_runtime_get_sync() returns 1 on success.  Consider using
pm_runtime_resume_and_get() instead.

    2714         } else {
    2715                 DRM_DEV_DEBUG_DRIVER(dev, "start to power off");
    2716                 pm_runtime_put_sync(dev);
    2717 
    2718                 drm_helper_hpd_irq_event(it6505->bridge.dev);
    2719                 memset(it6505->dpcd, 0, sizeof(it6505->dpcd));
    2720                 DRM_DEV_DEBUG_DRIVER(dev, "power off it6505 success!");
    2721         }
    2722 
    2723 unlock:
    2724         mutex_unlock(&it6505->extcon_lock);
    2725 }

regards,
dan carpenter

                 reply	other threads:[~2022-10-25 11:44 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=Y1fMCs6VnxbDcB41@kili \
    --to=dan.carpenter@oracle.com \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=treapking@chromium.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.