[bug report] drm/bridge: it6505: Adapt runtime power management framework
Dan Carpenter
dan.carpenter at oracle.com
Tue Oct 25 11:44:10 UTC 2022
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
More information about the dri-devel
mailing list