[drm-misc:drm-misc-next 25/26] drivers/gpu/drm/bridge/panel.c:367 devm_drm_panel_bridge_add_typed() error: 'bridge' dereferencing possible ERR_PTR()

Dan Carpenter error27 at gmail.com
Thu Dec 29 09:59:29 UTC 2022


tree:   git://anongit.freedesktop.org/drm/drm-misc drm-misc-next
head:   941aae3263153cea91cb306cc889951486e16634
commit: 5ea6b17027810ffbdb5bea7d0a2b1d312dd1021c [25/26] drm/panel: Add prepare_prev_first flag to drm_panel
config: nios2-randconfig-m041-20221228
compiler: nios2-linux-gcc (GCC) 12.1.0

If you fix the issue, kindly add following tag where applicable
| Reported-by: kernel test robot <lkp at intel.com>
| Reported-by: Dan Carpenter <error27 at gmail.com>

smatch warnings:
drivers/gpu/drm/bridge/panel.c:367 devm_drm_panel_bridge_add_typed() error: 'bridge' dereferencing possible ERR_PTR()

vim +/bridge +367 drivers/gpu/drm/bridge/panel.c

89958b7cd9555a Laurent Pinchart 2019-09-04  348  struct drm_bridge *devm_drm_panel_bridge_add_typed(struct device *dev,
67022227ffb1f5 Eric Anholt      2017-07-18  349  						   struct drm_panel *panel,
67022227ffb1f5 Eric Anholt      2017-07-18  350  						   u32 connector_type)
67022227ffb1f5 Eric Anholt      2017-07-18  351  {
67022227ffb1f5 Eric Anholt      2017-07-18  352  	struct drm_bridge **ptr, *bridge;
67022227ffb1f5 Eric Anholt      2017-07-18  353  
67022227ffb1f5 Eric Anholt      2017-07-18  354  	ptr = devres_alloc(devm_drm_panel_bridge_release, sizeof(*ptr),
67022227ffb1f5 Eric Anholt      2017-07-18  355  			   GFP_KERNEL);
67022227ffb1f5 Eric Anholt      2017-07-18  356  	if (!ptr)
67022227ffb1f5 Eric Anholt      2017-07-18  357  		return ERR_PTR(-ENOMEM);
67022227ffb1f5 Eric Anholt      2017-07-18  358  
89958b7cd9555a Laurent Pinchart 2019-09-04  359  	bridge = drm_panel_bridge_add_typed(panel, connector_type);
67022227ffb1f5 Eric Anholt      2017-07-18  360  	if (!IS_ERR(bridge)) {
67022227ffb1f5 Eric Anholt      2017-07-18  361  		*ptr = bridge;
67022227ffb1f5 Eric Anholt      2017-07-18  362  		devres_add(dev, ptr);
67022227ffb1f5 Eric Anholt      2017-07-18  363  	} else {
67022227ffb1f5 Eric Anholt      2017-07-18  364  		devres_free(ptr);

return -ENOMEM;

67022227ffb1f5 Eric Anholt      2017-07-18  365  	}
67022227ffb1f5 Eric Anholt      2017-07-18  366  
5ea6b17027810f Dave Stevenson   2022-12-05 @367  	bridge->pre_enable_prev_first = panel->prepare_prev_first;
                                                        ^^^^^^^^^^

5ea6b17027810f Dave Stevenson   2022-12-05  368  
67022227ffb1f5 Eric Anholt      2017-07-18  369  	return bridge;
67022227ffb1f5 Eric Anholt      2017-07-18  370  }

-- 
0-DAY CI Kernel Test Service
https://01.org/lkp



More information about the dri-devel mailing list