[PATCH v2 1/5] drm: Add helpers to kick off self refresh mode in drivers

Dan Carpenter dan.carpenter at oracle.com
Thu Mar 28 14:42:36 UTC 2019


Hi Sean,

url:    https://github.com/0day-ci/linux/commits/Sean-Paul/drm-Add-helpers-to-kick-off-self-refresh-mode-in-drivers/20190327-194853

smatch warnings:
drivers/gpu/drm/drm_self_refresh_helper.c:105 drm_self_refresh_helper_entry_work() error: uninitialized symbol 'ret'.

# https://github.com/0day-ci/linux/commit/f5a7344f61b9f1ff99802d4daa7fecbdf0040b42
git remote add linux-review https://github.com/0day-ci/linux
git remote update linux-review
git checkout f5a7344f61b9f1ff99802d4daa7fecbdf0040b42
vim +/ret +105 drivers/gpu/drm/drm_self_refresh_helper.c

f5a7344f Sean Paul 2019-03-26   50  
f5a7344f Sean Paul 2019-03-26   51  static void drm_self_refresh_helper_entry_work(struct work_struct *work)
f5a7344f Sean Paul 2019-03-26   52  {
f5a7344f Sean Paul 2019-03-26   53  	struct drm_self_refresh_state *sr_state = container_of(
f5a7344f Sean Paul 2019-03-26   54  				to_delayed_work(work),
f5a7344f Sean Paul 2019-03-26   55  				struct drm_self_refresh_state, entry_work);
f5a7344f Sean Paul 2019-03-26   56  	struct drm_crtc *crtc = sr_state->crtc;
f5a7344f Sean Paul 2019-03-26   57  	struct drm_device *dev = crtc->dev;
f5a7344f Sean Paul 2019-03-26   58  	struct drm_modeset_acquire_ctx ctx;
f5a7344f Sean Paul 2019-03-26   59  	struct drm_atomic_state *state;
f5a7344f Sean Paul 2019-03-26   60  	struct drm_connector *conn;
f5a7344f Sean Paul 2019-03-26   61  	struct drm_connector_state *conn_state;
f5a7344f Sean Paul 2019-03-26   62  	struct drm_crtc_state *crtc_state;
f5a7344f Sean Paul 2019-03-26   63  	int i, ret;
f5a7344f Sean Paul 2019-03-26   64  
f5a7344f Sean Paul 2019-03-26   65  	drm_modeset_acquire_init(&ctx, 0);
f5a7344f Sean Paul 2019-03-26   66  
f5a7344f Sean Paul 2019-03-26   67  	state = drm_atomic_state_alloc(dev);
f5a7344f Sean Paul 2019-03-26   68  	if (!state) {
f5a7344f Sean Paul 2019-03-26   69  		ret = -ENOMEM;
f5a7344f Sean Paul 2019-03-26   70  		goto out;
f5a7344f Sean Paul 2019-03-26   71  	}
f5a7344f Sean Paul 2019-03-26   72  
f5a7344f Sean Paul 2019-03-26   73  retry:
f5a7344f Sean Paul 2019-03-26   74  	state->acquire_ctx = &ctx;
f5a7344f Sean Paul 2019-03-26   75  
f5a7344f Sean Paul 2019-03-26   76  	crtc_state = drm_atomic_get_crtc_state(state, crtc);
f5a7344f Sean Paul 2019-03-26   77  	if (IS_ERR(crtc_state)) {
f5a7344f Sean Paul 2019-03-26   78  		ret = PTR_ERR(crtc_state);
f5a7344f Sean Paul 2019-03-26   79  		goto out;
f5a7344f Sean Paul 2019-03-26   80  	}
f5a7344f Sean Paul 2019-03-26   81  
f5a7344f Sean Paul 2019-03-26   82  	if (!crtc_state->enable)
f5a7344f Sean Paul 2019-03-26   83  		goto out;
                                                ^^^^^^^^
"ret" not set.

f5a7344f Sean Paul 2019-03-26   84  
f5a7344f Sean Paul 2019-03-26   85  	ret = drm_atomic_add_affected_connectors(state, crtc);
f5a7344f Sean Paul 2019-03-26   86  	if (ret)
f5a7344f Sean Paul 2019-03-26   87  		goto out;
f5a7344f Sean Paul 2019-03-26   88  
f5a7344f Sean Paul 2019-03-26   89  	crtc_state->active = false;
f5a7344f Sean Paul 2019-03-26   90  	crtc_state->self_refresh_active = true;
f5a7344f Sean Paul 2019-03-26   91  
f5a7344f Sean Paul 2019-03-26   92  	for_each_new_connector_in_state(state, conn, conn_state, i) {
f5a7344f Sean Paul 2019-03-26   93  		if (!conn_state->self_refresh_aware)
f5a7344f Sean Paul 2019-03-26   94  			goto out;
f5a7344f Sean Paul 2019-03-26   95  
f5a7344f Sean Paul 2019-03-26   96  		conn_state->self_refresh_changed = true;
f5a7344f Sean Paul 2019-03-26   97  		conn_state->self_refresh_active = true;
f5a7344f Sean Paul 2019-03-26   98  	}
f5a7344f Sean Paul 2019-03-26   99  
f5a7344f Sean Paul 2019-03-26  100  	ret = drm_atomic_commit(state);
f5a7344f Sean Paul 2019-03-26  101  	if (ret)
f5a7344f Sean Paul 2019-03-26  102  		goto out;
f5a7344f Sean Paul 2019-03-26  103  
f5a7344f Sean Paul 2019-03-26  104  out:
f5a7344f Sean Paul 2019-03-26 @105  	if (ret == -EDEADLK) {
f5a7344f Sean Paul 2019-03-26  106  		drm_atomic_state_clear(state);
f5a7344f Sean Paul 2019-03-26  107  		ret = drm_modeset_backoff(&ctx);
f5a7344f Sean Paul 2019-03-26  108  		if (!ret)
f5a7344f Sean Paul 2019-03-26  109  			goto retry;
f5a7344f Sean Paul 2019-03-26  110  	}
f5a7344f Sean Paul 2019-03-26  111  
f5a7344f Sean Paul 2019-03-26  112  	drm_atomic_state_put(state);
f5a7344f Sean Paul 2019-03-26  113  	drm_modeset_drop_locks(&ctx);
f5a7344f Sean Paul 2019-03-26  114  	drm_modeset_acquire_fini(&ctx);
f5a7344f Sean Paul 2019-03-26  115  }
f5a7344f Sean Paul 2019-03-26  116  

---
0-DAY kernel test infrastructure                Open Source Technology Center
https://lists.01.org/pipermail/kbuild-all                   Intel Corporation


More information about the dri-devel mailing list