[PATCH 2/2] drm: bridge: ti-sn65dsi83: Add error recovery mechanism
Dan Carpenter
dan.carpenter at linaro.org
Mon Oct 28 08:28:20 UTC 2024
Hi Herve,
kernel test robot noticed the following build warnings:
https://git-scm.com/docs/git-format-patch#_base_tree_information]
url: https://github.com/intel-lab-lkp/linux/commits/Herve-Codina/dt-bindings-display-bridge-sn65dsi83-Add-interrupt/20241024-175758
base: https://git.kernel.org/pub/scm/linux/kernel/git/robh/linux.git for-next
patch link: https://lore.kernel.org/r/20241024095539.1637280-3-herve.codina%40bootlin.com
patch subject: [PATCH 2/2] drm: bridge: ti-sn65dsi83: Add error recovery mechanism
config: csky-randconfig-r073-20241026 (https://download.01.org/0day-ci/archive/20241026/202410262052.CRR7XezU-lkp@intel.com/config)
compiler: csky-linux-gcc (GCC) 14.1.0
If you fix the issue in a separate patch/commit (i.e. not just a new version of
the same patch/commit), kindly add following tags
| Reported-by: kernel test robot <lkp at intel.com>
| Reported-by: Dan Carpenter <dan.carpenter at linaro.org>
| Closes: https://lore.kernel.org/r/202410262052.CRR7XezU-lkp@intel.com/
smatch warnings:
drivers/gpu/drm/bridge/ti-sn65dsi83.c:360 sn65dsi83_reset_pipeline() error: uninitialized symbol 'state'.
vim +/state +360 drivers/gpu/drm/bridge/ti-sn65dsi83.c
caeb909b9ed830 Herve Codina 2024-10-24 330 static int sn65dsi83_reset_pipeline(struct sn65dsi83 *sn65dsi83)
caeb909b9ed830 Herve Codina 2024-10-24 331 {
caeb909b9ed830 Herve Codina 2024-10-24 332 struct drm_device *dev = sn65dsi83->bridge.dev;
caeb909b9ed830 Herve Codina 2024-10-24 333 struct drm_modeset_acquire_ctx ctx;
caeb909b9ed830 Herve Codina 2024-10-24 334 struct drm_atomic_state *state;
Almost everyone has their compiler set to zero out stack variables these days.
You should set this to struct drm_atomic_state *state = ERR_PTR(-EINVAL);.
caeb909b9ed830 Herve Codina 2024-10-24 335 int err;
caeb909b9ed830 Herve Codina 2024-10-24 336
caeb909b9ed830 Herve Codina 2024-10-24 337 /* Use operation done in drm_atomic_helper_suspend() followed by
caeb909b9ed830 Herve Codina 2024-10-24 338 * operation done in drm_atomic_helper_resume() but without releasing
caeb909b9ed830 Herve Codina 2024-10-24 339 * the lock between suspend()/resume()
caeb909b9ed830 Herve Codina 2024-10-24 340 */
caeb909b9ed830 Herve Codina 2024-10-24 341
caeb909b9ed830 Herve Codina 2024-10-24 342 DRM_MODESET_LOCK_ALL_BEGIN(dev, ctx, 0, err);
This macro has a goto in it.
caeb909b9ed830 Herve Codina 2024-10-24 343
caeb909b9ed830 Herve Codina 2024-10-24 344 state = drm_atomic_helper_duplicate_state(dev, &ctx);
caeb909b9ed830 Herve Codina 2024-10-24 345 if (IS_ERR(state)) {
caeb909b9ed830 Herve Codina 2024-10-24 346 err = PTR_ERR(state);
caeb909b9ed830 Herve Codina 2024-10-24 347 goto unlock;
caeb909b9ed830 Herve Codina 2024-10-24 348 }
caeb909b9ed830 Herve Codina 2024-10-24 349
caeb909b9ed830 Herve Codina 2024-10-24 350 err = drm_atomic_helper_disable_all(dev, &ctx);
caeb909b9ed830 Herve Codina 2024-10-24 351 if (err < 0)
caeb909b9ed830 Herve Codina 2024-10-24 352 goto unlock;
caeb909b9ed830 Herve Codina 2024-10-24 353
caeb909b9ed830 Herve Codina 2024-10-24 354 drm_mode_config_reset(dev);
caeb909b9ed830 Herve Codina 2024-10-24 355
caeb909b9ed830 Herve Codina 2024-10-24 356 err = drm_atomic_helper_commit_duplicated_state(state, &ctx);
caeb909b9ed830 Herve Codina 2024-10-24 357
caeb909b9ed830 Herve Codina 2024-10-24 358 unlock:
caeb909b9ed830 Herve Codina 2024-10-24 359 DRM_MODESET_LOCK_ALL_END(dev, ctx, err);
caeb909b9ed830 Herve Codina 2024-10-24 @360 if (!IS_ERR(state))
caeb909b9ed830 Herve Codina 2024-10-24 361 drm_atomic_state_put(state);
Calling drm_atomic_state_put(NULL) leads to an Oops.
caeb909b9ed830 Herve Codina 2024-10-24 362 return err;
caeb909b9ed830 Herve Codina 2024-10-24 363 }
--
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki
More information about the dri-devel
mailing list