All of lore.kernel.org
 help / color / mirror / Atom feed
* drivers/gpu/drm/amd/amdgpu/../display/dc/dce110/dce110_hw_sequencer.c:1018 dce110_edp_backlight_control() error: we previously assumed 'link->panel_cntl' could be null (see line 977)
@ 2022-03-03 11:46 ` Dan Carpenter
  0 siblings, 0 replies; 10+ messages in thread
From: kernel test robot @ 2022-03-01 17:28 UTC (permalink / raw)
  To: kbuild

[-- Attachment #1: Type: text/plain, Size: 9058 bytes --]

CC: kbuild-all(a)lists.01.org
BCC: lkp(a)intel.com
CC: linux-kernel(a)vger.kernel.org
TO: Jake Wang <haonan.wang2@amd.com>
CC: Alex Deucher <alexander.deucher@amd.com>
CC: Aric Cyr <Aric.Cyr@amd.com>

tree:   https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master
head:   719fce7539cd3e186598e2aed36325fe892150cf
commit: 06ddcee49a35981835e04910bef462a09f108984 drm/amd/display: Added multi instance support for panel control
date:   11 months ago
:::::: branch date: 21 hours ago
:::::: commit date: 11 months ago
config: powerpc-randconfig-m031-20220301 (https://download.01.org/0day-ci/archive/20220302/202203020137.M32nCNIJ-lkp(a)intel.com/config)
compiler: powerpc-linux-gcc (GCC) 11.2.0

If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp@intel.com>
Reported-by: Dan Carpenter <dan.carpenter@oracle.com>

smatch warnings:
drivers/gpu/drm/amd/amdgpu/../display/dc/dce110/dce110_hw_sequencer.c:1018 dce110_edp_backlight_control() error: we previously assumed 'link->panel_cntl' could be null (see line 977)

vim +1018 drivers/gpu/drm/amd/amdgpu/../display/dc/dce110/dce110_hw_sequencer.c

cf3a26275977947 Jun Lei           2020-11-24   957  
5eefbc40173644b Yue Hin Lau       2017-09-15   958  /*todo: cloned in stream enc, fix*/
5eefbc40173644b Yue Hin Lau       2017-09-15   959  /*
5eefbc40173644b Yue Hin Lau       2017-09-15   960   * @brief
5eefbc40173644b Yue Hin Lau       2017-09-15   961   * eDP only. Control the backlight of the eDP panel
5eefbc40173644b Yue Hin Lau       2017-09-15   962   */
8a31820b12187c7 Martin Leung      2019-07-09   963  void dce110_edp_backlight_control(
5eefbc40173644b Yue Hin Lau       2017-09-15   964  		struct dc_link *link,
5eefbc40173644b Yue Hin Lau       2017-09-15   965  		bool enable)
5eefbc40173644b Yue Hin Lau       2017-09-15   966  {
069d418f412ec4b Andrew Jiang      2017-09-26   967  	struct dc_context *ctx = link->ctx;
5eefbc40173644b Yue Hin Lau       2017-09-15   968  	struct bp_transmitter_control cntl = { 0 };
06ddcee49a35981 Jake Wang         2021-02-23   969  	uint8_t panel_instance;
5eefbc40173644b Yue Hin Lau       2017-09-15   970  
069d418f412ec4b Andrew Jiang      2017-09-26   971  	if (dal_graphics_object_id_get_connector_id(link->link_enc->connector)
5eefbc40173644b Yue Hin Lau       2017-09-15   972  		!= CONNECTOR_ID_EDP) {
5eefbc40173644b Yue Hin Lau       2017-09-15   973  		BREAK_TO_DEBUGGER();
5eefbc40173644b Yue Hin Lau       2017-09-15   974  		return;
5eefbc40173644b Yue Hin Lau       2017-09-15   975  	}
5eefbc40173644b Yue Hin Lau       2017-09-15   976  
014427adc5565a0 Sherry            2020-11-11  @977  	if (link->panel_cntl) {
014427adc5565a0 Sherry            2020-11-11   978  		bool is_backlight_on = link->panel_cntl->funcs->is_panel_backlight_on(link->panel_cntl);
014427adc5565a0 Sherry            2020-11-11   979  
014427adc5565a0 Sherry            2020-11-11   980  		if ((enable && is_backlight_on) || (!enable && !is_backlight_on)) {
1296423bf23c7a5 Bhawanpreet Lakha 2018-02-20   981  			DC_LOG_HW_RESUME_S3(
014427adc5565a0 Sherry            2020-11-11   982  				"%s: panel already powered up/off. Do nothing.\n",
5eefbc40173644b Yue Hin Lau       2017-09-15   983  				__func__);
5eefbc40173644b Yue Hin Lau       2017-09-15   984  			return;
5eefbc40173644b Yue Hin Lau       2017-09-15   985  		}
014427adc5565a0 Sherry            2020-11-11   986  	}
5eefbc40173644b Yue Hin Lau       2017-09-15   987  
5eefbc40173644b Yue Hin Lau       2017-09-15   988  	/* Send VBIOS command to control eDP panel backlight */
5eefbc40173644b Yue Hin Lau       2017-09-15   989  
1296423bf23c7a5 Bhawanpreet Lakha 2018-02-20   990  	DC_LOG_HW_RESUME_S3(
5eefbc40173644b Yue Hin Lau       2017-09-15   991  			"%s: backlight action: %s\n",
5eefbc40173644b Yue Hin Lau       2017-09-15   992  			__func__, (enable ? "On":"Off"));
5eefbc40173644b Yue Hin Lau       2017-09-15   993  
5eefbc40173644b Yue Hin Lau       2017-09-15   994  	cntl.action = enable ?
5eefbc40173644b Yue Hin Lau       2017-09-15   995  		TRANSMITTER_CONTROL_BACKLIGHT_ON :
5eefbc40173644b Yue Hin Lau       2017-09-15   996  		TRANSMITTER_CONTROL_BACKLIGHT_OFF;
8740196935625df Andrew Jiang      2017-09-25   997  
5eefbc40173644b Yue Hin Lau       2017-09-15   998  	/*cntl.engine_id = ctx->engine;*/
5eefbc40173644b Yue Hin Lau       2017-09-15   999  	cntl.transmitter = link->link_enc->transmitter;
5eefbc40173644b Yue Hin Lau       2017-09-15  1000  	cntl.connector_obj_id = link->link_enc->connector;
5eefbc40173644b Yue Hin Lau       2017-09-15  1001  	/*todo: unhardcode*/
5eefbc40173644b Yue Hin Lau       2017-09-15  1002  	cntl.lanes_number = LANE_COUNT_FOUR;
5eefbc40173644b Yue Hin Lau       2017-09-15  1003  	cntl.hpd_sel = link->link_enc->hpd_source;
cf1835f03ffb3b5 Charlene Liu      2018-01-08  1004  	cntl.signal = SIGNAL_TYPE_EDP;
5eefbc40173644b Yue Hin Lau       2017-09-15  1005  
5eefbc40173644b Yue Hin Lau       2017-09-15  1006  	/* For eDP, the following delays might need to be considered
5eefbc40173644b Yue Hin Lau       2017-09-15  1007  	 * after link training completed:
5eefbc40173644b Yue Hin Lau       2017-09-15  1008  	 * idle period - min. accounts for required BS-Idle pattern,
5eefbc40173644b Yue Hin Lau       2017-09-15  1009  	 * max. allows for source frame synchronization);
5eefbc40173644b Yue Hin Lau       2017-09-15  1010  	 * 50 msec max. delay from valid video data from source
5eefbc40173644b Yue Hin Lau       2017-09-15  1011  	 * to video on dislpay or backlight enable.
5eefbc40173644b Yue Hin Lau       2017-09-15  1012  	 *
5eefbc40173644b Yue Hin Lau       2017-09-15  1013  	 * Disable the delay for now.
5eefbc40173644b Yue Hin Lau       2017-09-15  1014  	 * Enable it in the future if necessary.
5eefbc40173644b Yue Hin Lau       2017-09-15  1015  	 */
5eefbc40173644b Yue Hin Lau       2017-09-15  1016  	/* dc_service_sleep_in_milliseconds(50); */
5180d4a4766d7df Charlene Liu      2018-01-18  1017  		/*edp 1.2*/
06ddcee49a35981 Jake Wang         2021-02-23 @1018  	panel_instance = link->panel_cntl->inst;
5180d4a4766d7df Charlene Liu      2018-01-18  1019  	if (cntl.action == TRANSMITTER_CONTROL_BACKLIGHT_ON)
5180d4a4766d7df Charlene Liu      2018-01-18  1020  		edp_receiver_ready_T7(link);
8a0e210c048e97f Chris Park        2020-08-05  1021  
8a0e210c048e97f Chris Park        2020-08-05  1022  	if (ctx->dc->ctx->dmub_srv &&
8a0e210c048e97f Chris Park        2020-08-05  1023  			ctx->dc->debug.dmub_command_table) {
8a0e210c048e97f Chris Park        2020-08-05  1024  		if (cntl.action == TRANSMITTER_CONTROL_BACKLIGHT_ON)
8a0e210c048e97f Chris Park        2020-08-05  1025  			ctx->dc_bios->funcs->enable_lvtma_control(ctx->dc_bios,
06ddcee49a35981 Jake Wang         2021-02-23  1026  					LVTMA_CONTROL_LCD_BLON,
06ddcee49a35981 Jake Wang         2021-02-23  1027  					panel_instance);
8a0e210c048e97f Chris Park        2020-08-05  1028  		else
8a0e210c048e97f Chris Park        2020-08-05  1029  			ctx->dc_bios->funcs->enable_lvtma_control(ctx->dc_bios,
06ddcee49a35981 Jake Wang         2021-02-23  1030  					LVTMA_CONTROL_LCD_BLOFF,
06ddcee49a35981 Jake Wang         2021-02-23  1031  					panel_instance);
8a0e210c048e97f Chris Park        2020-08-05  1032  	}
8a0e210c048e97f Chris Park        2020-08-05  1033  
069d418f412ec4b Andrew Jiang      2017-09-26  1034  	link_transmitter_control(ctx->dc_bios, &cntl);
96577cf82a13317 Hersen Wu         2020-01-14  1035  
96577cf82a13317 Hersen Wu         2020-01-14  1036  	if (enable && link->dpcd_sink_ext_caps.bits.oled)
96577cf82a13317 Hersen Wu         2020-01-14  1037  		msleep(OLED_POST_T7_DELAY);
96577cf82a13317 Hersen Wu         2020-01-14  1038  
96577cf82a13317 Hersen Wu         2020-01-14  1039  	if (link->dpcd_sink_ext_caps.bits.oled ||
96577cf82a13317 Hersen Wu         2020-01-14  1040  		link->dpcd_sink_ext_caps.bits.hdr_aux_backlight_control == 1 ||
96577cf82a13317 Hersen Wu         2020-01-14  1041  		link->dpcd_sink_ext_caps.bits.sdr_aux_backlight_control == 1)
96577cf82a13317 Hersen Wu         2020-01-14  1042  		dc_link_backlight_enable_aux(link, enable);
96577cf82a13317 Hersen Wu         2020-01-14  1043  
69b9723a81e74e5 Charlene Liu      2018-01-18  1044  	/*edp 1.2*/
5180d4a4766d7df Charlene Liu      2018-01-18  1045  	if (cntl.action == TRANSMITTER_CONTROL_BACKLIGHT_OFF)
3a372bed1e337ef Hugo Hu           2020-10-06  1046  		edp_add_delay_for_T9(link);
96577cf82a13317 Hersen Wu         2020-01-14  1047  
96577cf82a13317 Hersen Wu         2020-01-14  1048  	if (!enable && link->dpcd_sink_ext_caps.bits.oled)
96577cf82a13317 Hersen Wu         2020-01-14  1049  		msleep(OLED_PRE_T11_DELAY);
5eefbc40173644b Yue Hin Lau       2017-09-15  1050  }
5eefbc40173644b Yue Hin Lau       2017-09-15  1051  

---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all(a)lists.01.org

^ permalink raw reply	[flat|nested] 10+ messages in thread

* drivers/gpu/drm/amd/amdgpu/../display/dc/dce110/dce110_hw_sequencer.c:1018 dce110_edp_backlight_control() error: we previously assumed 'link->panel_cntl' could be null (see line 977)
@ 2022-03-03 11:46 ` Dan Carpenter
  0 siblings, 0 replies; 10+ messages in thread
From: Dan Carpenter @ 2022-03-03 11:46 UTC (permalink / raw)
  To: kbuild, Jake Wang; +Cc: lkp, kbuild-all, linux-kernel, Alex Deucher, Aric Cyr

tree:   https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master
head:   719fce7539cd3e186598e2aed36325fe892150cf
commit: 06ddcee49a35981835e04910bef462a09f108984 drm/amd/display: Added multi instance support for panel control
config: powerpc-randconfig-m031-20220301 (https://download.01.org/0day-ci/archive/20220302/202203020137.M32nCNIJ-lkp@intel.com/config)
compiler: powerpc-linux-gcc (GCC) 11.2.0

If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp@intel.com>
Reported-by: Dan Carpenter <dan.carpenter@oracle.com>

smatch warnings:
drivers/gpu/drm/amd/amdgpu/../display/dc/dce110/dce110_hw_sequencer.c:1018 dce110_edp_backlight_control() error: we previously assumed 'link->panel_cntl' could be null (see line 977)

vim +1018 drivers/gpu/drm/amd/amdgpu/../display/dc/dce110/dce110_hw_sequencer.c

8a31820b12187c7 Martin Leung      2019-07-09   963  void dce110_edp_backlight_control(
5eefbc40173644b Yue Hin Lau       2017-09-15   964  		struct dc_link *link,
5eefbc40173644b Yue Hin Lau       2017-09-15   965  		bool enable)
5eefbc40173644b Yue Hin Lau       2017-09-15   966  {
069d418f412ec4b Andrew Jiang      2017-09-26   967  	struct dc_context *ctx = link->ctx;
5eefbc40173644b Yue Hin Lau       2017-09-15   968  	struct bp_transmitter_control cntl = { 0 };
06ddcee49a35981 Jake Wang         2021-02-23   969  	uint8_t panel_instance;
5eefbc40173644b Yue Hin Lau       2017-09-15   970  
069d418f412ec4b Andrew Jiang      2017-09-26   971  	if (dal_graphics_object_id_get_connector_id(link->link_enc->connector)
5eefbc40173644b Yue Hin Lau       2017-09-15   972  		!= CONNECTOR_ID_EDP) {
5eefbc40173644b Yue Hin Lau       2017-09-15   973  		BREAK_TO_DEBUGGER();
5eefbc40173644b Yue Hin Lau       2017-09-15   974  		return;
5eefbc40173644b Yue Hin Lau       2017-09-15   975  	}
5eefbc40173644b Yue Hin Lau       2017-09-15   976  
014427adc5565a0 Sherry            2020-11-11  @977  	if (link->panel_cntl) {
                                                            ^^^^^^^^^^^^^^^^
This code assumes "link->panel_cntl" can be NULL

014427adc5565a0 Sherry            2020-11-11   978  		bool is_backlight_on = link->panel_cntl->funcs->is_panel_backlight_on(link->panel_cntl);
014427adc5565a0 Sherry            2020-11-11   979  
014427adc5565a0 Sherry            2020-11-11   980  		if ((enable && is_backlight_on) || (!enable && !is_backlight_on)) {
1296423bf23c7a5 Bhawanpreet Lakha 2018-02-20   981  			DC_LOG_HW_RESUME_S3(
014427adc5565a0 Sherry            2020-11-11   982  				"%s: panel already powered up/off. Do nothing.\n",
5eefbc40173644b Yue Hin Lau       2017-09-15   983  				__func__);
5eefbc40173644b Yue Hin Lau       2017-09-15   984  			return;
5eefbc40173644b Yue Hin Lau       2017-09-15   985  		}
014427adc5565a0 Sherry            2020-11-11   986  	}
5eefbc40173644b Yue Hin Lau       2017-09-15   987  
5eefbc40173644b Yue Hin Lau       2017-09-15   988  	/* Send VBIOS command to control eDP panel backlight */
5eefbc40173644b Yue Hin Lau       2017-09-15   989  
1296423bf23c7a5 Bhawanpreet Lakha 2018-02-20   990  	DC_LOG_HW_RESUME_S3(
5eefbc40173644b Yue Hin Lau       2017-09-15   991  			"%s: backlight action: %s\n",
5eefbc40173644b Yue Hin Lau       2017-09-15   992  			__func__, (enable ? "On":"Off"));
5eefbc40173644b Yue Hin Lau       2017-09-15   993  
5eefbc40173644b Yue Hin Lau       2017-09-15   994  	cntl.action = enable ?
5eefbc40173644b Yue Hin Lau       2017-09-15   995  		TRANSMITTER_CONTROL_BACKLIGHT_ON :
5eefbc40173644b Yue Hin Lau       2017-09-15   996  		TRANSMITTER_CONTROL_BACKLIGHT_OFF;
8740196935625df Andrew Jiang      2017-09-25   997  
5eefbc40173644b Yue Hin Lau       2017-09-15   998  	/*cntl.engine_id = ctx->engine;*/
5eefbc40173644b Yue Hin Lau       2017-09-15   999  	cntl.transmitter = link->link_enc->transmitter;
5eefbc40173644b Yue Hin Lau       2017-09-15  1000  	cntl.connector_obj_id = link->link_enc->connector;
5eefbc40173644b Yue Hin Lau       2017-09-15  1001  	/*todo: unhardcode*/
5eefbc40173644b Yue Hin Lau       2017-09-15  1002  	cntl.lanes_number = LANE_COUNT_FOUR;
5eefbc40173644b Yue Hin Lau       2017-09-15  1003  	cntl.hpd_sel = link->link_enc->hpd_source;
cf1835f03ffb3b5 Charlene Liu      2018-01-08  1004  	cntl.signal = SIGNAL_TYPE_EDP;
5eefbc40173644b Yue Hin Lau       2017-09-15  1005  
5eefbc40173644b Yue Hin Lau       2017-09-15  1006  	/* For eDP, the following delays might need to be considered
5eefbc40173644b Yue Hin Lau       2017-09-15  1007  	 * after link training completed:
5eefbc40173644b Yue Hin Lau       2017-09-15  1008  	 * idle period - min. accounts for required BS-Idle pattern,
5eefbc40173644b Yue Hin Lau       2017-09-15  1009  	 * max. allows for source frame synchronization);
5eefbc40173644b Yue Hin Lau       2017-09-15  1010  	 * 50 msec max. delay from valid video data from source
5eefbc40173644b Yue Hin Lau       2017-09-15  1011  	 * to video on dislpay or backlight enable.
5eefbc40173644b Yue Hin Lau       2017-09-15  1012  	 *
5eefbc40173644b Yue Hin Lau       2017-09-15  1013  	 * Disable the delay for now.
5eefbc40173644b Yue Hin Lau       2017-09-15  1014  	 * Enable it in the future if necessary.
5eefbc40173644b Yue Hin Lau       2017-09-15  1015  	 */
5eefbc40173644b Yue Hin Lau       2017-09-15  1016  	/* dc_service_sleep_in_milliseconds(50); */
5180d4a4766d7df Charlene Liu      2018-01-18  1017  		/*edp 1.2*/
06ddcee49a35981 Jake Wang         2021-02-23 @1018  	panel_instance = link->panel_cntl->inst;
                                                                         ^^^^^^^^^^^^^^^^^^
Unchecked dereference.

5180d4a4766d7df Charlene Liu      2018-01-18  1019  	if (cntl.action == TRANSMITTER_CONTROL_BACKLIGHT_ON)
5180d4a4766d7df Charlene Liu      2018-01-18  1020  		edp_receiver_ready_T7(link);
8a0e210c048e97f Chris Park        2020-08-05  1021  
8a0e210c048e97f Chris Park        2020-08-05  1022  	if (ctx->dc->ctx->dmub_srv &&
8a0e210c048e97f Chris Park        2020-08-05  1023  			ctx->dc->debug.dmub_command_table) {
8a0e210c048e97f Chris Park        2020-08-05  1024  		if (cntl.action == TRANSMITTER_CONTROL_BACKLIGHT_ON)
8a0e210c048e97f Chris Park        2020-08-05  1025  			ctx->dc_bios->funcs->enable_lvtma_control(ctx->dc_bios,
06ddcee49a35981 Jake Wang         2021-02-23  1026  					LVTMA_CONTROL_LCD_BLON,
06ddcee49a35981 Jake Wang         2021-02-23  1027  					panel_instance);
8a0e210c048e97f Chris Park        2020-08-05  1028  		else
8a0e210c048e97f Chris Park        2020-08-05  1029  			ctx->dc_bios->funcs->enable_lvtma_control(ctx->dc_bios,
06ddcee49a35981 Jake Wang         2021-02-23  1030  					LVTMA_CONTROL_LCD_BLOFF,
06ddcee49a35981 Jake Wang         2021-02-23  1031  					panel_instance);
8a0e210c048e97f Chris Park        2020-08-05  1032  	}
8a0e210c048e97f Chris Park        2020-08-05  1033  
069d418f412ec4b Andrew Jiang      2017-09-26  1034  	link_transmitter_control(ctx->dc_bios, &cntl);
96577cf82a13317 Hersen Wu         2020-01-14  1035  
96577cf82a13317 Hersen Wu         2020-01-14  1036  	if (enable && link->dpcd_sink_ext_caps.bits.oled)
96577cf82a13317 Hersen Wu         2020-01-14  1037  		msleep(OLED_POST_T7_DELAY);
96577cf82a13317 Hersen Wu         2020-01-14  1038  
96577cf82a13317 Hersen Wu         2020-01-14  1039  	if (link->dpcd_sink_ext_caps.bits.oled ||
96577cf82a13317 Hersen Wu         2020-01-14  1040  		link->dpcd_sink_ext_caps.bits.hdr_aux_backlight_control == 1 ||
96577cf82a13317 Hersen Wu         2020-01-14  1041  		link->dpcd_sink_ext_caps.bits.sdr_aux_backlight_control == 1)
96577cf82a13317 Hersen Wu         2020-01-14  1042  		dc_link_backlight_enable_aux(link, enable);
96577cf82a13317 Hersen Wu         2020-01-14  1043  
69b9723a81e74e5 Charlene Liu      2018-01-18  1044  	/*edp 1.2*/
5180d4a4766d7df Charlene Liu      2018-01-18  1045  	if (cntl.action == TRANSMITTER_CONTROL_BACKLIGHT_OFF)
3a372bed1e337ef Hugo Hu           2020-10-06  1046  		edp_add_delay_for_T9(link);
96577cf82a13317 Hersen Wu         2020-01-14  1047  
96577cf82a13317 Hersen Wu         2020-01-14  1048  	if (!enable && link->dpcd_sink_ext_caps.bits.oled)
96577cf82a13317 Hersen Wu         2020-01-14  1049  		msleep(OLED_PRE_T11_DELAY);
5eefbc40173644b Yue Hin Lau       2017-09-15  1050  }

---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all@lists.01.org


^ permalink raw reply	[flat|nested] 10+ messages in thread

* drivers/gpu/drm/amd/amdgpu/../display/dc/dce110/dce110_hw_sequencer.c:1018 dce110_edp_backlight_control() error: we previously assumed 'link->panel_cntl' could be null (see line 977)
@ 2022-03-03 11:46 ` Dan Carpenter
  0 siblings, 0 replies; 10+ messages in thread
From: Dan Carpenter @ 2022-03-03 11:46 UTC (permalink / raw)
  To: kbuild-all

[-- Attachment #1: Type: text/plain, Size: 8531 bytes --]

tree:   https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master
head:   719fce7539cd3e186598e2aed36325fe892150cf
commit: 06ddcee49a35981835e04910bef462a09f108984 drm/amd/display: Added multi instance support for panel control
config: powerpc-randconfig-m031-20220301 (https://download.01.org/0day-ci/archive/20220302/202203020137.M32nCNIJ-lkp(a)intel.com/config)
compiler: powerpc-linux-gcc (GCC) 11.2.0

If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp@intel.com>
Reported-by: Dan Carpenter <dan.carpenter@oracle.com>

smatch warnings:
drivers/gpu/drm/amd/amdgpu/../display/dc/dce110/dce110_hw_sequencer.c:1018 dce110_edp_backlight_control() error: we previously assumed 'link->panel_cntl' could be null (see line 977)

vim +1018 drivers/gpu/drm/amd/amdgpu/../display/dc/dce110/dce110_hw_sequencer.c

8a31820b12187c7 Martin Leung      2019-07-09   963  void dce110_edp_backlight_control(
5eefbc40173644b Yue Hin Lau       2017-09-15   964  		struct dc_link *link,
5eefbc40173644b Yue Hin Lau       2017-09-15   965  		bool enable)
5eefbc40173644b Yue Hin Lau       2017-09-15   966  {
069d418f412ec4b Andrew Jiang      2017-09-26   967  	struct dc_context *ctx = link->ctx;
5eefbc40173644b Yue Hin Lau       2017-09-15   968  	struct bp_transmitter_control cntl = { 0 };
06ddcee49a35981 Jake Wang         2021-02-23   969  	uint8_t panel_instance;
5eefbc40173644b Yue Hin Lau       2017-09-15   970  
069d418f412ec4b Andrew Jiang      2017-09-26   971  	if (dal_graphics_object_id_get_connector_id(link->link_enc->connector)
5eefbc40173644b Yue Hin Lau       2017-09-15   972  		!= CONNECTOR_ID_EDP) {
5eefbc40173644b Yue Hin Lau       2017-09-15   973  		BREAK_TO_DEBUGGER();
5eefbc40173644b Yue Hin Lau       2017-09-15   974  		return;
5eefbc40173644b Yue Hin Lau       2017-09-15   975  	}
5eefbc40173644b Yue Hin Lau       2017-09-15   976  
014427adc5565a0 Sherry            2020-11-11  @977  	if (link->panel_cntl) {
                                                            ^^^^^^^^^^^^^^^^
This code assumes "link->panel_cntl" can be NULL

014427adc5565a0 Sherry            2020-11-11   978  		bool is_backlight_on = link->panel_cntl->funcs->is_panel_backlight_on(link->panel_cntl);
014427adc5565a0 Sherry            2020-11-11   979  
014427adc5565a0 Sherry            2020-11-11   980  		if ((enable && is_backlight_on) || (!enable && !is_backlight_on)) {
1296423bf23c7a5 Bhawanpreet Lakha 2018-02-20   981  			DC_LOG_HW_RESUME_S3(
014427adc5565a0 Sherry            2020-11-11   982  				"%s: panel already powered up/off. Do nothing.\n",
5eefbc40173644b Yue Hin Lau       2017-09-15   983  				__func__);
5eefbc40173644b Yue Hin Lau       2017-09-15   984  			return;
5eefbc40173644b Yue Hin Lau       2017-09-15   985  		}
014427adc5565a0 Sherry            2020-11-11   986  	}
5eefbc40173644b Yue Hin Lau       2017-09-15   987  
5eefbc40173644b Yue Hin Lau       2017-09-15   988  	/* Send VBIOS command to control eDP panel backlight */
5eefbc40173644b Yue Hin Lau       2017-09-15   989  
1296423bf23c7a5 Bhawanpreet Lakha 2018-02-20   990  	DC_LOG_HW_RESUME_S3(
5eefbc40173644b Yue Hin Lau       2017-09-15   991  			"%s: backlight action: %s\n",
5eefbc40173644b Yue Hin Lau       2017-09-15   992  			__func__, (enable ? "On":"Off"));
5eefbc40173644b Yue Hin Lau       2017-09-15   993  
5eefbc40173644b Yue Hin Lau       2017-09-15   994  	cntl.action = enable ?
5eefbc40173644b Yue Hin Lau       2017-09-15   995  		TRANSMITTER_CONTROL_BACKLIGHT_ON :
5eefbc40173644b Yue Hin Lau       2017-09-15   996  		TRANSMITTER_CONTROL_BACKLIGHT_OFF;
8740196935625df Andrew Jiang      2017-09-25   997  
5eefbc40173644b Yue Hin Lau       2017-09-15   998  	/*cntl.engine_id = ctx->engine;*/
5eefbc40173644b Yue Hin Lau       2017-09-15   999  	cntl.transmitter = link->link_enc->transmitter;
5eefbc40173644b Yue Hin Lau       2017-09-15  1000  	cntl.connector_obj_id = link->link_enc->connector;
5eefbc40173644b Yue Hin Lau       2017-09-15  1001  	/*todo: unhardcode*/
5eefbc40173644b Yue Hin Lau       2017-09-15  1002  	cntl.lanes_number = LANE_COUNT_FOUR;
5eefbc40173644b Yue Hin Lau       2017-09-15  1003  	cntl.hpd_sel = link->link_enc->hpd_source;
cf1835f03ffb3b5 Charlene Liu      2018-01-08  1004  	cntl.signal = SIGNAL_TYPE_EDP;
5eefbc40173644b Yue Hin Lau       2017-09-15  1005  
5eefbc40173644b Yue Hin Lau       2017-09-15  1006  	/* For eDP, the following delays might need to be considered
5eefbc40173644b Yue Hin Lau       2017-09-15  1007  	 * after link training completed:
5eefbc40173644b Yue Hin Lau       2017-09-15  1008  	 * idle period - min. accounts for required BS-Idle pattern,
5eefbc40173644b Yue Hin Lau       2017-09-15  1009  	 * max. allows for source frame synchronization);
5eefbc40173644b Yue Hin Lau       2017-09-15  1010  	 * 50 msec max. delay from valid video data from source
5eefbc40173644b Yue Hin Lau       2017-09-15  1011  	 * to video on dislpay or backlight enable.
5eefbc40173644b Yue Hin Lau       2017-09-15  1012  	 *
5eefbc40173644b Yue Hin Lau       2017-09-15  1013  	 * Disable the delay for now.
5eefbc40173644b Yue Hin Lau       2017-09-15  1014  	 * Enable it in the future if necessary.
5eefbc40173644b Yue Hin Lau       2017-09-15  1015  	 */
5eefbc40173644b Yue Hin Lau       2017-09-15  1016  	/* dc_service_sleep_in_milliseconds(50); */
5180d4a4766d7df Charlene Liu      2018-01-18  1017  		/*edp 1.2*/
06ddcee49a35981 Jake Wang         2021-02-23 @1018  	panel_instance = link->panel_cntl->inst;
                                                                         ^^^^^^^^^^^^^^^^^^
Unchecked dereference.

5180d4a4766d7df Charlene Liu      2018-01-18  1019  	if (cntl.action == TRANSMITTER_CONTROL_BACKLIGHT_ON)
5180d4a4766d7df Charlene Liu      2018-01-18  1020  		edp_receiver_ready_T7(link);
8a0e210c048e97f Chris Park        2020-08-05  1021  
8a0e210c048e97f Chris Park        2020-08-05  1022  	if (ctx->dc->ctx->dmub_srv &&
8a0e210c048e97f Chris Park        2020-08-05  1023  			ctx->dc->debug.dmub_command_table) {
8a0e210c048e97f Chris Park        2020-08-05  1024  		if (cntl.action == TRANSMITTER_CONTROL_BACKLIGHT_ON)
8a0e210c048e97f Chris Park        2020-08-05  1025  			ctx->dc_bios->funcs->enable_lvtma_control(ctx->dc_bios,
06ddcee49a35981 Jake Wang         2021-02-23  1026  					LVTMA_CONTROL_LCD_BLON,
06ddcee49a35981 Jake Wang         2021-02-23  1027  					panel_instance);
8a0e210c048e97f Chris Park        2020-08-05  1028  		else
8a0e210c048e97f Chris Park        2020-08-05  1029  			ctx->dc_bios->funcs->enable_lvtma_control(ctx->dc_bios,
06ddcee49a35981 Jake Wang         2021-02-23  1030  					LVTMA_CONTROL_LCD_BLOFF,
06ddcee49a35981 Jake Wang         2021-02-23  1031  					panel_instance);
8a0e210c048e97f Chris Park        2020-08-05  1032  	}
8a0e210c048e97f Chris Park        2020-08-05  1033  
069d418f412ec4b Andrew Jiang      2017-09-26  1034  	link_transmitter_control(ctx->dc_bios, &cntl);
96577cf82a13317 Hersen Wu         2020-01-14  1035  
96577cf82a13317 Hersen Wu         2020-01-14  1036  	if (enable && link->dpcd_sink_ext_caps.bits.oled)
96577cf82a13317 Hersen Wu         2020-01-14  1037  		msleep(OLED_POST_T7_DELAY);
96577cf82a13317 Hersen Wu         2020-01-14  1038  
96577cf82a13317 Hersen Wu         2020-01-14  1039  	if (link->dpcd_sink_ext_caps.bits.oled ||
96577cf82a13317 Hersen Wu         2020-01-14  1040  		link->dpcd_sink_ext_caps.bits.hdr_aux_backlight_control == 1 ||
96577cf82a13317 Hersen Wu         2020-01-14  1041  		link->dpcd_sink_ext_caps.bits.sdr_aux_backlight_control == 1)
96577cf82a13317 Hersen Wu         2020-01-14  1042  		dc_link_backlight_enable_aux(link, enable);
96577cf82a13317 Hersen Wu         2020-01-14  1043  
69b9723a81e74e5 Charlene Liu      2018-01-18  1044  	/*edp 1.2*/
5180d4a4766d7df Charlene Liu      2018-01-18  1045  	if (cntl.action == TRANSMITTER_CONTROL_BACKLIGHT_OFF)
3a372bed1e337ef Hugo Hu           2020-10-06  1046  		edp_add_delay_for_T9(link);
96577cf82a13317 Hersen Wu         2020-01-14  1047  
96577cf82a13317 Hersen Wu         2020-01-14  1048  	if (!enable && link->dpcd_sink_ext_caps.bits.oled)
96577cf82a13317 Hersen Wu         2020-01-14  1049  		msleep(OLED_PRE_T11_DELAY);
5eefbc40173644b Yue Hin Lau       2017-09-15  1050  }

---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all(a)lists.01.org

^ permalink raw reply	[flat|nested] 10+ messages in thread

* drivers/gpu/drm/amd/amdgpu/../display/dc/dce110/dce110_hw_sequencer.c:1018 dce110_edp_backlight_control() error: we previously assumed 'link->panel_cntl' could be null (see line 977)
@ 2022-03-09 10:31 ` Dan Carpenter
  0 siblings, 0 replies; 10+ messages in thread
From: Dan Carpenter @ 2022-03-09 10:31 UTC (permalink / raw)
  To: kbuild, Jake Wang; +Cc: lkp, kbuild-all, linux-kernel, Alex Deucher, Aric Cyr

tree:   https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master
head:   330f4c53d3c2d8b11d86ec03a964b86dc81452f5
commit: 06ddcee49a35981835e04910bef462a09f108984 drm/amd/display: Added multi instance support for panel control
config: powerpc-randconfig-m031-20220301 (https://download.01.org/0day-ci/archive/20220309/202203091542.wWXRk9o1-lkp@intel.com/config)
compiler: powerpc-linux-gcc (GCC) 11.2.0

If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp@intel.com>
Reported-by: Dan Carpenter <dan.carpenter@oracle.com>

smatch warnings:
drivers/gpu/drm/amd/amdgpu/../display/dc/dce110/dce110_hw_sequencer.c:1018 dce110_edp_backlight_control() error: we previously assumed 'link->panel_cntl' could be null (see line 977)

vim +1018 drivers/gpu/drm/amd/amdgpu/../display/dc/dce110/dce110_hw_sequencer.c

8a31820b12187c7 Martin Leung      2019-07-09   963  void dce110_edp_backlight_control(
5eefbc40173644b Yue Hin Lau       2017-09-15   964  		struct dc_link *link,
5eefbc40173644b Yue Hin Lau       2017-09-15   965  		bool enable)
5eefbc40173644b Yue Hin Lau       2017-09-15   966  {
069d418f412ec4b Andrew Jiang      2017-09-26   967  	struct dc_context *ctx = link->ctx;
5eefbc40173644b Yue Hin Lau       2017-09-15   968  	struct bp_transmitter_control cntl = { 0 };
06ddcee49a35981 Jake Wang         2021-02-23   969  	uint8_t panel_instance;
5eefbc40173644b Yue Hin Lau       2017-09-15   970  
069d418f412ec4b Andrew Jiang      2017-09-26   971  	if (dal_graphics_object_id_get_connector_id(link->link_enc->connector)
5eefbc40173644b Yue Hin Lau       2017-09-15   972  		!= CONNECTOR_ID_EDP) {
5eefbc40173644b Yue Hin Lau       2017-09-15   973  		BREAK_TO_DEBUGGER();
5eefbc40173644b Yue Hin Lau       2017-09-15   974  		return;
5eefbc40173644b Yue Hin Lau       2017-09-15   975  	}
5eefbc40173644b Yue Hin Lau       2017-09-15   976  
014427adc5565a0 Sherry            2020-11-11  @977  	if (link->panel_cntl) {
                                                            ^^^^^^^^^^^^^^^^
This code assumes "link->panel_cntl" can be NULL

014427adc5565a0 Sherry            2020-11-11   978  		bool is_backlight_on = link->panel_cntl->funcs->is_panel_backlight_on(link->panel_cntl);
014427adc5565a0 Sherry            2020-11-11   979  
014427adc5565a0 Sherry            2020-11-11   980  		if ((enable && is_backlight_on) || (!enable && !is_backlight_on)) {
1296423bf23c7a5 Bhawanpreet Lakha 2018-02-20   981  			DC_LOG_HW_RESUME_S3(
014427adc5565a0 Sherry            2020-11-11   982  				"%s: panel already powered up/off. Do nothing.\n",
5eefbc40173644b Yue Hin Lau       2017-09-15   983  				__func__);
5eefbc40173644b Yue Hin Lau       2017-09-15   984  			return;
5eefbc40173644b Yue Hin Lau       2017-09-15   985  		}
014427adc5565a0 Sherry            2020-11-11   986  	}
5eefbc40173644b Yue Hin Lau       2017-09-15   987  
5eefbc40173644b Yue Hin Lau       2017-09-15   988  	/* Send VBIOS command to control eDP panel backlight */
5eefbc40173644b Yue Hin Lau       2017-09-15   989  
1296423bf23c7a5 Bhawanpreet Lakha 2018-02-20   990  	DC_LOG_HW_RESUME_S3(
5eefbc40173644b Yue Hin Lau       2017-09-15   991  			"%s: backlight action: %s\n",
5eefbc40173644b Yue Hin Lau       2017-09-15   992  			__func__, (enable ? "On":"Off"));
5eefbc40173644b Yue Hin Lau       2017-09-15   993  
5eefbc40173644b Yue Hin Lau       2017-09-15   994  	cntl.action = enable ?
5eefbc40173644b Yue Hin Lau       2017-09-15   995  		TRANSMITTER_CONTROL_BACKLIGHT_ON :
5eefbc40173644b Yue Hin Lau       2017-09-15   996  		TRANSMITTER_CONTROL_BACKLIGHT_OFF;
8740196935625df Andrew Jiang      2017-09-25   997  
5eefbc40173644b Yue Hin Lau       2017-09-15   998  	/*cntl.engine_id = ctx->engine;*/
5eefbc40173644b Yue Hin Lau       2017-09-15   999  	cntl.transmitter = link->link_enc->transmitter;
5eefbc40173644b Yue Hin Lau       2017-09-15  1000  	cntl.connector_obj_id = link->link_enc->connector;
5eefbc40173644b Yue Hin Lau       2017-09-15  1001  	/*todo: unhardcode*/
5eefbc40173644b Yue Hin Lau       2017-09-15  1002  	cntl.lanes_number = LANE_COUNT_FOUR;
5eefbc40173644b Yue Hin Lau       2017-09-15  1003  	cntl.hpd_sel = link->link_enc->hpd_source;
cf1835f03ffb3b5 Charlene Liu      2018-01-08  1004  	cntl.signal = SIGNAL_TYPE_EDP;
5eefbc40173644b Yue Hin Lau       2017-09-15  1005  
5eefbc40173644b Yue Hin Lau       2017-09-15  1006  	/* For eDP, the following delays might need to be considered
5eefbc40173644b Yue Hin Lau       2017-09-15  1007  	 * after link training completed:
5eefbc40173644b Yue Hin Lau       2017-09-15  1008  	 * idle period - min. accounts for required BS-Idle pattern,
5eefbc40173644b Yue Hin Lau       2017-09-15  1009  	 * max. allows for source frame synchronization);
5eefbc40173644b Yue Hin Lau       2017-09-15  1010  	 * 50 msec max. delay from valid video data from source
5eefbc40173644b Yue Hin Lau       2017-09-15  1011  	 * to video on dislpay or backlight enable.
5eefbc40173644b Yue Hin Lau       2017-09-15  1012  	 *
5eefbc40173644b Yue Hin Lau       2017-09-15  1013  	 * Disable the delay for now.
5eefbc40173644b Yue Hin Lau       2017-09-15  1014  	 * Enable it in the future if necessary.
5eefbc40173644b Yue Hin Lau       2017-09-15  1015  	 */
5eefbc40173644b Yue Hin Lau       2017-09-15  1016  	/* dc_service_sleep_in_milliseconds(50); */
5180d4a4766d7df Charlene Liu      2018-01-18  1017  		/*edp 1.2*/
06ddcee49a35981 Jake Wang         2021-02-23 @1018  	panel_instance = link->panel_cntl->inst;
                                                                         ^^^^^^^^^^^^^^^^^^^^^^
Unchecked dereference

5180d4a4766d7df Charlene Liu      2018-01-18  1019  	if (cntl.action == TRANSMITTER_CONTROL_BACKLIGHT_ON)
5180d4a4766d7df Charlene Liu      2018-01-18  1020  		edp_receiver_ready_T7(link);
8a0e210c048e97f Chris Park        2020-08-05  1021  
8a0e210c048e97f Chris Park        2020-08-05  1022  	if (ctx->dc->ctx->dmub_srv &&
8a0e210c048e97f Chris Park        2020-08-05  1023  			ctx->dc->debug.dmub_command_table) {
8a0e210c048e97f Chris Park        2020-08-05  1024  		if (cntl.action == TRANSMITTER_CONTROL_BACKLIGHT_ON)
8a0e210c048e97f Chris Park        2020-08-05  1025  			ctx->dc_bios->funcs->enable_lvtma_control(ctx->dc_bios,
06ddcee49a35981 Jake Wang         2021-02-23  1026  					LVTMA_CONTROL_LCD_BLON,
06ddcee49a35981 Jake Wang         2021-02-23  1027  					panel_instance);
8a0e210c048e97f Chris Park        2020-08-05  1028  		else
8a0e210c048e97f Chris Park        2020-08-05  1029  			ctx->dc_bios->funcs->enable_lvtma_control(ctx->dc_bios,
06ddcee49a35981 Jake Wang         2021-02-23  1030  					LVTMA_CONTROL_LCD_BLOFF,
06ddcee49a35981 Jake Wang         2021-02-23  1031  					panel_instance);
8a0e210c048e97f Chris Park        2020-08-05  1032  	}
8a0e210c048e97f Chris Park        2020-08-05  1033  
069d418f412ec4b Andrew Jiang      2017-09-26  1034  	link_transmitter_control(ctx->dc_bios, &cntl);
96577cf82a13317 Hersen Wu         2020-01-14  1035  
96577cf82a13317 Hersen Wu         2020-01-14  1036  	if (enable && link->dpcd_sink_ext_caps.bits.oled)
96577cf82a13317 Hersen Wu         2020-01-14  1037  		msleep(OLED_POST_T7_DELAY);
96577cf82a13317 Hersen Wu         2020-01-14  1038  
96577cf82a13317 Hersen Wu         2020-01-14  1039  	if (link->dpcd_sink_ext_caps.bits.oled ||
96577cf82a13317 Hersen Wu         2020-01-14  1040  		link->dpcd_sink_ext_caps.bits.hdr_aux_backlight_control == 1 ||
96577cf82a13317 Hersen Wu         2020-01-14  1041  		link->dpcd_sink_ext_caps.bits.sdr_aux_backlight_control == 1)
96577cf82a13317 Hersen Wu         2020-01-14  1042  		dc_link_backlight_enable_aux(link, enable);
96577cf82a13317 Hersen Wu         2020-01-14  1043  
69b9723a81e74e5 Charlene Liu      2018-01-18  1044  	/*edp 1.2*/
5180d4a4766d7df Charlene Liu      2018-01-18  1045  	if (cntl.action == TRANSMITTER_CONTROL_BACKLIGHT_OFF)
3a372bed1e337ef Hugo Hu           2020-10-06  1046  		edp_add_delay_for_T9(link);
96577cf82a13317 Hersen Wu         2020-01-14  1047  
96577cf82a13317 Hersen Wu         2020-01-14  1048  	if (!enable && link->dpcd_sink_ext_caps.bits.oled)
96577cf82a13317 Hersen Wu         2020-01-14  1049  		msleep(OLED_PRE_T11_DELAY);
5eefbc40173644b Yue Hin Lau       2017-09-15  1050  }

---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all@lists.01.org


^ permalink raw reply	[flat|nested] 10+ messages in thread

* drivers/gpu/drm/amd/amdgpu/../display/dc/dce110/dce110_hw_sequencer.c:1018 dce110_edp_backlight_control() error: we previously assumed 'link->panel_cntl' could be null (see line 977)
@ 2022-03-09 10:31 ` Dan Carpenter
  0 siblings, 0 replies; 10+ messages in thread
From: Dan Carpenter @ 2022-03-09 10:31 UTC (permalink / raw)
  To: kbuild-all

[-- Attachment #1: Type: text/plain, Size: 8534 bytes --]

tree:   https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master
head:   330f4c53d3c2d8b11d86ec03a964b86dc81452f5
commit: 06ddcee49a35981835e04910bef462a09f108984 drm/amd/display: Added multi instance support for panel control
config: powerpc-randconfig-m031-20220301 (https://download.01.org/0day-ci/archive/20220309/202203091542.wWXRk9o1-lkp(a)intel.com/config)
compiler: powerpc-linux-gcc (GCC) 11.2.0

If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp@intel.com>
Reported-by: Dan Carpenter <dan.carpenter@oracle.com>

smatch warnings:
drivers/gpu/drm/amd/amdgpu/../display/dc/dce110/dce110_hw_sequencer.c:1018 dce110_edp_backlight_control() error: we previously assumed 'link->panel_cntl' could be null (see line 977)

vim +1018 drivers/gpu/drm/amd/amdgpu/../display/dc/dce110/dce110_hw_sequencer.c

8a31820b12187c7 Martin Leung      2019-07-09   963  void dce110_edp_backlight_control(
5eefbc40173644b Yue Hin Lau       2017-09-15   964  		struct dc_link *link,
5eefbc40173644b Yue Hin Lau       2017-09-15   965  		bool enable)
5eefbc40173644b Yue Hin Lau       2017-09-15   966  {
069d418f412ec4b Andrew Jiang      2017-09-26   967  	struct dc_context *ctx = link->ctx;
5eefbc40173644b Yue Hin Lau       2017-09-15   968  	struct bp_transmitter_control cntl = { 0 };
06ddcee49a35981 Jake Wang         2021-02-23   969  	uint8_t panel_instance;
5eefbc40173644b Yue Hin Lau       2017-09-15   970  
069d418f412ec4b Andrew Jiang      2017-09-26   971  	if (dal_graphics_object_id_get_connector_id(link->link_enc->connector)
5eefbc40173644b Yue Hin Lau       2017-09-15   972  		!= CONNECTOR_ID_EDP) {
5eefbc40173644b Yue Hin Lau       2017-09-15   973  		BREAK_TO_DEBUGGER();
5eefbc40173644b Yue Hin Lau       2017-09-15   974  		return;
5eefbc40173644b Yue Hin Lau       2017-09-15   975  	}
5eefbc40173644b Yue Hin Lau       2017-09-15   976  
014427adc5565a0 Sherry            2020-11-11  @977  	if (link->panel_cntl) {
                                                            ^^^^^^^^^^^^^^^^
This code assumes "link->panel_cntl" can be NULL

014427adc5565a0 Sherry            2020-11-11   978  		bool is_backlight_on = link->panel_cntl->funcs->is_panel_backlight_on(link->panel_cntl);
014427adc5565a0 Sherry            2020-11-11   979  
014427adc5565a0 Sherry            2020-11-11   980  		if ((enable && is_backlight_on) || (!enable && !is_backlight_on)) {
1296423bf23c7a5 Bhawanpreet Lakha 2018-02-20   981  			DC_LOG_HW_RESUME_S3(
014427adc5565a0 Sherry            2020-11-11   982  				"%s: panel already powered up/off. Do nothing.\n",
5eefbc40173644b Yue Hin Lau       2017-09-15   983  				__func__);
5eefbc40173644b Yue Hin Lau       2017-09-15   984  			return;
5eefbc40173644b Yue Hin Lau       2017-09-15   985  		}
014427adc5565a0 Sherry            2020-11-11   986  	}
5eefbc40173644b Yue Hin Lau       2017-09-15   987  
5eefbc40173644b Yue Hin Lau       2017-09-15   988  	/* Send VBIOS command to control eDP panel backlight */
5eefbc40173644b Yue Hin Lau       2017-09-15   989  
1296423bf23c7a5 Bhawanpreet Lakha 2018-02-20   990  	DC_LOG_HW_RESUME_S3(
5eefbc40173644b Yue Hin Lau       2017-09-15   991  			"%s: backlight action: %s\n",
5eefbc40173644b Yue Hin Lau       2017-09-15   992  			__func__, (enable ? "On":"Off"));
5eefbc40173644b Yue Hin Lau       2017-09-15   993  
5eefbc40173644b Yue Hin Lau       2017-09-15   994  	cntl.action = enable ?
5eefbc40173644b Yue Hin Lau       2017-09-15   995  		TRANSMITTER_CONTROL_BACKLIGHT_ON :
5eefbc40173644b Yue Hin Lau       2017-09-15   996  		TRANSMITTER_CONTROL_BACKLIGHT_OFF;
8740196935625df Andrew Jiang      2017-09-25   997  
5eefbc40173644b Yue Hin Lau       2017-09-15   998  	/*cntl.engine_id = ctx->engine;*/
5eefbc40173644b Yue Hin Lau       2017-09-15   999  	cntl.transmitter = link->link_enc->transmitter;
5eefbc40173644b Yue Hin Lau       2017-09-15  1000  	cntl.connector_obj_id = link->link_enc->connector;
5eefbc40173644b Yue Hin Lau       2017-09-15  1001  	/*todo: unhardcode*/
5eefbc40173644b Yue Hin Lau       2017-09-15  1002  	cntl.lanes_number = LANE_COUNT_FOUR;
5eefbc40173644b Yue Hin Lau       2017-09-15  1003  	cntl.hpd_sel = link->link_enc->hpd_source;
cf1835f03ffb3b5 Charlene Liu      2018-01-08  1004  	cntl.signal = SIGNAL_TYPE_EDP;
5eefbc40173644b Yue Hin Lau       2017-09-15  1005  
5eefbc40173644b Yue Hin Lau       2017-09-15  1006  	/* For eDP, the following delays might need to be considered
5eefbc40173644b Yue Hin Lau       2017-09-15  1007  	 * after link training completed:
5eefbc40173644b Yue Hin Lau       2017-09-15  1008  	 * idle period - min. accounts for required BS-Idle pattern,
5eefbc40173644b Yue Hin Lau       2017-09-15  1009  	 * max. allows for source frame synchronization);
5eefbc40173644b Yue Hin Lau       2017-09-15  1010  	 * 50 msec max. delay from valid video data from source
5eefbc40173644b Yue Hin Lau       2017-09-15  1011  	 * to video on dislpay or backlight enable.
5eefbc40173644b Yue Hin Lau       2017-09-15  1012  	 *
5eefbc40173644b Yue Hin Lau       2017-09-15  1013  	 * Disable the delay for now.
5eefbc40173644b Yue Hin Lau       2017-09-15  1014  	 * Enable it in the future if necessary.
5eefbc40173644b Yue Hin Lau       2017-09-15  1015  	 */
5eefbc40173644b Yue Hin Lau       2017-09-15  1016  	/* dc_service_sleep_in_milliseconds(50); */
5180d4a4766d7df Charlene Liu      2018-01-18  1017  		/*edp 1.2*/
06ddcee49a35981 Jake Wang         2021-02-23 @1018  	panel_instance = link->panel_cntl->inst;
                                                                         ^^^^^^^^^^^^^^^^^^^^^^
Unchecked dereference

5180d4a4766d7df Charlene Liu      2018-01-18  1019  	if (cntl.action == TRANSMITTER_CONTROL_BACKLIGHT_ON)
5180d4a4766d7df Charlene Liu      2018-01-18  1020  		edp_receiver_ready_T7(link);
8a0e210c048e97f Chris Park        2020-08-05  1021  
8a0e210c048e97f Chris Park        2020-08-05  1022  	if (ctx->dc->ctx->dmub_srv &&
8a0e210c048e97f Chris Park        2020-08-05  1023  			ctx->dc->debug.dmub_command_table) {
8a0e210c048e97f Chris Park        2020-08-05  1024  		if (cntl.action == TRANSMITTER_CONTROL_BACKLIGHT_ON)
8a0e210c048e97f Chris Park        2020-08-05  1025  			ctx->dc_bios->funcs->enable_lvtma_control(ctx->dc_bios,
06ddcee49a35981 Jake Wang         2021-02-23  1026  					LVTMA_CONTROL_LCD_BLON,
06ddcee49a35981 Jake Wang         2021-02-23  1027  					panel_instance);
8a0e210c048e97f Chris Park        2020-08-05  1028  		else
8a0e210c048e97f Chris Park        2020-08-05  1029  			ctx->dc_bios->funcs->enable_lvtma_control(ctx->dc_bios,
06ddcee49a35981 Jake Wang         2021-02-23  1030  					LVTMA_CONTROL_LCD_BLOFF,
06ddcee49a35981 Jake Wang         2021-02-23  1031  					panel_instance);
8a0e210c048e97f Chris Park        2020-08-05  1032  	}
8a0e210c048e97f Chris Park        2020-08-05  1033  
069d418f412ec4b Andrew Jiang      2017-09-26  1034  	link_transmitter_control(ctx->dc_bios, &cntl);
96577cf82a13317 Hersen Wu         2020-01-14  1035  
96577cf82a13317 Hersen Wu         2020-01-14  1036  	if (enable && link->dpcd_sink_ext_caps.bits.oled)
96577cf82a13317 Hersen Wu         2020-01-14  1037  		msleep(OLED_POST_T7_DELAY);
96577cf82a13317 Hersen Wu         2020-01-14  1038  
96577cf82a13317 Hersen Wu         2020-01-14  1039  	if (link->dpcd_sink_ext_caps.bits.oled ||
96577cf82a13317 Hersen Wu         2020-01-14  1040  		link->dpcd_sink_ext_caps.bits.hdr_aux_backlight_control == 1 ||
96577cf82a13317 Hersen Wu         2020-01-14  1041  		link->dpcd_sink_ext_caps.bits.sdr_aux_backlight_control == 1)
96577cf82a13317 Hersen Wu         2020-01-14  1042  		dc_link_backlight_enable_aux(link, enable);
96577cf82a13317 Hersen Wu         2020-01-14  1043  
69b9723a81e74e5 Charlene Liu      2018-01-18  1044  	/*edp 1.2*/
5180d4a4766d7df Charlene Liu      2018-01-18  1045  	if (cntl.action == TRANSMITTER_CONTROL_BACKLIGHT_OFF)
3a372bed1e337ef Hugo Hu           2020-10-06  1046  		edp_add_delay_for_T9(link);
96577cf82a13317 Hersen Wu         2020-01-14  1047  
96577cf82a13317 Hersen Wu         2020-01-14  1048  	if (!enable && link->dpcd_sink_ext_caps.bits.oled)
96577cf82a13317 Hersen Wu         2020-01-14  1049  		msleep(OLED_PRE_T11_DELAY);
5eefbc40173644b Yue Hin Lau       2017-09-15  1050  }

---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all(a)lists.01.org

^ permalink raw reply	[flat|nested] 10+ messages in thread

* drivers/gpu/drm/amd/amdgpu/../display/dc/dce110/dce110_hw_sequencer.c:1018 dce110_edp_backlight_control() error: we previously assumed 'link->panel_cntl' could be null (see line 977)
@ 2022-03-09 10:31 ` Dan Carpenter
  0 siblings, 0 replies; 10+ messages in thread
From: kernel test robot @ 2022-03-09  7:32 UTC (permalink / raw)
  To: kbuild

[-- Attachment #1: Type: text/plain, Size: 9058 bytes --]

CC: kbuild-all(a)lists.01.org
BCC: lkp(a)intel.com
CC: linux-kernel(a)vger.kernel.org
TO: Jake Wang <haonan.wang2@amd.com>
CC: Alex Deucher <alexander.deucher@amd.com>
CC: Aric Cyr <Aric.Cyr@amd.com>

tree:   https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master
head:   330f4c53d3c2d8b11d86ec03a964b86dc81452f5
commit: 06ddcee49a35981835e04910bef462a09f108984 drm/amd/display: Added multi instance support for panel control
date:   12 months ago
:::::: branch date: 11 hours ago
:::::: commit date: 12 months ago
config: powerpc-randconfig-m031-20220301 (https://download.01.org/0day-ci/archive/20220309/202203091542.wWXRk9o1-lkp(a)intel.com/config)
compiler: powerpc-linux-gcc (GCC) 11.2.0

If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp@intel.com>
Reported-by: Dan Carpenter <dan.carpenter@oracle.com>

smatch warnings:
drivers/gpu/drm/amd/amdgpu/../display/dc/dce110/dce110_hw_sequencer.c:1018 dce110_edp_backlight_control() error: we previously assumed 'link->panel_cntl' could be null (see line 977)

vim +1018 drivers/gpu/drm/amd/amdgpu/../display/dc/dce110/dce110_hw_sequencer.c

cf3a26275977947 Jun Lei           2020-11-24   957  
5eefbc40173644b Yue Hin Lau       2017-09-15   958  /*todo: cloned in stream enc, fix*/
5eefbc40173644b Yue Hin Lau       2017-09-15   959  /*
5eefbc40173644b Yue Hin Lau       2017-09-15   960   * @brief
5eefbc40173644b Yue Hin Lau       2017-09-15   961   * eDP only. Control the backlight of the eDP panel
5eefbc40173644b Yue Hin Lau       2017-09-15   962   */
8a31820b12187c7 Martin Leung      2019-07-09   963  void dce110_edp_backlight_control(
5eefbc40173644b Yue Hin Lau       2017-09-15   964  		struct dc_link *link,
5eefbc40173644b Yue Hin Lau       2017-09-15   965  		bool enable)
5eefbc40173644b Yue Hin Lau       2017-09-15   966  {
069d418f412ec4b Andrew Jiang      2017-09-26   967  	struct dc_context *ctx = link->ctx;
5eefbc40173644b Yue Hin Lau       2017-09-15   968  	struct bp_transmitter_control cntl = { 0 };
06ddcee49a35981 Jake Wang         2021-02-23   969  	uint8_t panel_instance;
5eefbc40173644b Yue Hin Lau       2017-09-15   970  
069d418f412ec4b Andrew Jiang      2017-09-26   971  	if (dal_graphics_object_id_get_connector_id(link->link_enc->connector)
5eefbc40173644b Yue Hin Lau       2017-09-15   972  		!= CONNECTOR_ID_EDP) {
5eefbc40173644b Yue Hin Lau       2017-09-15   973  		BREAK_TO_DEBUGGER();
5eefbc40173644b Yue Hin Lau       2017-09-15   974  		return;
5eefbc40173644b Yue Hin Lau       2017-09-15   975  	}
5eefbc40173644b Yue Hin Lau       2017-09-15   976  
014427adc5565a0 Sherry            2020-11-11  @977  	if (link->panel_cntl) {
014427adc5565a0 Sherry            2020-11-11   978  		bool is_backlight_on = link->panel_cntl->funcs->is_panel_backlight_on(link->panel_cntl);
014427adc5565a0 Sherry            2020-11-11   979  
014427adc5565a0 Sherry            2020-11-11   980  		if ((enable && is_backlight_on) || (!enable && !is_backlight_on)) {
1296423bf23c7a5 Bhawanpreet Lakha 2018-02-20   981  			DC_LOG_HW_RESUME_S3(
014427adc5565a0 Sherry            2020-11-11   982  				"%s: panel already powered up/off. Do nothing.\n",
5eefbc40173644b Yue Hin Lau       2017-09-15   983  				__func__);
5eefbc40173644b Yue Hin Lau       2017-09-15   984  			return;
5eefbc40173644b Yue Hin Lau       2017-09-15   985  		}
014427adc5565a0 Sherry            2020-11-11   986  	}
5eefbc40173644b Yue Hin Lau       2017-09-15   987  
5eefbc40173644b Yue Hin Lau       2017-09-15   988  	/* Send VBIOS command to control eDP panel backlight */
5eefbc40173644b Yue Hin Lau       2017-09-15   989  
1296423bf23c7a5 Bhawanpreet Lakha 2018-02-20   990  	DC_LOG_HW_RESUME_S3(
5eefbc40173644b Yue Hin Lau       2017-09-15   991  			"%s: backlight action: %s\n",
5eefbc40173644b Yue Hin Lau       2017-09-15   992  			__func__, (enable ? "On":"Off"));
5eefbc40173644b Yue Hin Lau       2017-09-15   993  
5eefbc40173644b Yue Hin Lau       2017-09-15   994  	cntl.action = enable ?
5eefbc40173644b Yue Hin Lau       2017-09-15   995  		TRANSMITTER_CONTROL_BACKLIGHT_ON :
5eefbc40173644b Yue Hin Lau       2017-09-15   996  		TRANSMITTER_CONTROL_BACKLIGHT_OFF;
8740196935625df Andrew Jiang      2017-09-25   997  
5eefbc40173644b Yue Hin Lau       2017-09-15   998  	/*cntl.engine_id = ctx->engine;*/
5eefbc40173644b Yue Hin Lau       2017-09-15   999  	cntl.transmitter = link->link_enc->transmitter;
5eefbc40173644b Yue Hin Lau       2017-09-15  1000  	cntl.connector_obj_id = link->link_enc->connector;
5eefbc40173644b Yue Hin Lau       2017-09-15  1001  	/*todo: unhardcode*/
5eefbc40173644b Yue Hin Lau       2017-09-15  1002  	cntl.lanes_number = LANE_COUNT_FOUR;
5eefbc40173644b Yue Hin Lau       2017-09-15  1003  	cntl.hpd_sel = link->link_enc->hpd_source;
cf1835f03ffb3b5 Charlene Liu      2018-01-08  1004  	cntl.signal = SIGNAL_TYPE_EDP;
5eefbc40173644b Yue Hin Lau       2017-09-15  1005  
5eefbc40173644b Yue Hin Lau       2017-09-15  1006  	/* For eDP, the following delays might need to be considered
5eefbc40173644b Yue Hin Lau       2017-09-15  1007  	 * after link training completed:
5eefbc40173644b Yue Hin Lau       2017-09-15  1008  	 * idle period - min. accounts for required BS-Idle pattern,
5eefbc40173644b Yue Hin Lau       2017-09-15  1009  	 * max. allows for source frame synchronization);
5eefbc40173644b Yue Hin Lau       2017-09-15  1010  	 * 50 msec max. delay from valid video data from source
5eefbc40173644b Yue Hin Lau       2017-09-15  1011  	 * to video on dislpay or backlight enable.
5eefbc40173644b Yue Hin Lau       2017-09-15  1012  	 *
5eefbc40173644b Yue Hin Lau       2017-09-15  1013  	 * Disable the delay for now.
5eefbc40173644b Yue Hin Lau       2017-09-15  1014  	 * Enable it in the future if necessary.
5eefbc40173644b Yue Hin Lau       2017-09-15  1015  	 */
5eefbc40173644b Yue Hin Lau       2017-09-15  1016  	/* dc_service_sleep_in_milliseconds(50); */
5180d4a4766d7df Charlene Liu      2018-01-18  1017  		/*edp 1.2*/
06ddcee49a35981 Jake Wang         2021-02-23 @1018  	panel_instance = link->panel_cntl->inst;
5180d4a4766d7df Charlene Liu      2018-01-18  1019  	if (cntl.action == TRANSMITTER_CONTROL_BACKLIGHT_ON)
5180d4a4766d7df Charlene Liu      2018-01-18  1020  		edp_receiver_ready_T7(link);
8a0e210c048e97f Chris Park        2020-08-05  1021  
8a0e210c048e97f Chris Park        2020-08-05  1022  	if (ctx->dc->ctx->dmub_srv &&
8a0e210c048e97f Chris Park        2020-08-05  1023  			ctx->dc->debug.dmub_command_table) {
8a0e210c048e97f Chris Park        2020-08-05  1024  		if (cntl.action == TRANSMITTER_CONTROL_BACKLIGHT_ON)
8a0e210c048e97f Chris Park        2020-08-05  1025  			ctx->dc_bios->funcs->enable_lvtma_control(ctx->dc_bios,
06ddcee49a35981 Jake Wang         2021-02-23  1026  					LVTMA_CONTROL_LCD_BLON,
06ddcee49a35981 Jake Wang         2021-02-23  1027  					panel_instance);
8a0e210c048e97f Chris Park        2020-08-05  1028  		else
8a0e210c048e97f Chris Park        2020-08-05  1029  			ctx->dc_bios->funcs->enable_lvtma_control(ctx->dc_bios,
06ddcee49a35981 Jake Wang         2021-02-23  1030  					LVTMA_CONTROL_LCD_BLOFF,
06ddcee49a35981 Jake Wang         2021-02-23  1031  					panel_instance);
8a0e210c048e97f Chris Park        2020-08-05  1032  	}
8a0e210c048e97f Chris Park        2020-08-05  1033  
069d418f412ec4b Andrew Jiang      2017-09-26  1034  	link_transmitter_control(ctx->dc_bios, &cntl);
96577cf82a13317 Hersen Wu         2020-01-14  1035  
96577cf82a13317 Hersen Wu         2020-01-14  1036  	if (enable && link->dpcd_sink_ext_caps.bits.oled)
96577cf82a13317 Hersen Wu         2020-01-14  1037  		msleep(OLED_POST_T7_DELAY);
96577cf82a13317 Hersen Wu         2020-01-14  1038  
96577cf82a13317 Hersen Wu         2020-01-14  1039  	if (link->dpcd_sink_ext_caps.bits.oled ||
96577cf82a13317 Hersen Wu         2020-01-14  1040  		link->dpcd_sink_ext_caps.bits.hdr_aux_backlight_control == 1 ||
96577cf82a13317 Hersen Wu         2020-01-14  1041  		link->dpcd_sink_ext_caps.bits.sdr_aux_backlight_control == 1)
96577cf82a13317 Hersen Wu         2020-01-14  1042  		dc_link_backlight_enable_aux(link, enable);
96577cf82a13317 Hersen Wu         2020-01-14  1043  
69b9723a81e74e5 Charlene Liu      2018-01-18  1044  	/*edp 1.2*/
5180d4a4766d7df Charlene Liu      2018-01-18  1045  	if (cntl.action == TRANSMITTER_CONTROL_BACKLIGHT_OFF)
3a372bed1e337ef Hugo Hu           2020-10-06  1046  		edp_add_delay_for_T9(link);
96577cf82a13317 Hersen Wu         2020-01-14  1047  
96577cf82a13317 Hersen Wu         2020-01-14  1048  	if (!enable && link->dpcd_sink_ext_caps.bits.oled)
96577cf82a13317 Hersen Wu         2020-01-14  1049  		msleep(OLED_PRE_T11_DELAY);
5eefbc40173644b Yue Hin Lau       2017-09-15  1050  }
5eefbc40173644b Yue Hin Lau       2017-09-15  1051  

---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all(a)lists.01.org

^ permalink raw reply	[flat|nested] 10+ messages in thread

* drivers/gpu/drm/amd/amdgpu/../display/dc/dce110/dce110_hw_sequencer.c:1018 dce110_edp_backlight_control() error: we previously assumed 'link->panel_cntl' could be null (see line 977)
@ 2022-03-03 19:02 kernel test robot
  0 siblings, 0 replies; 10+ messages in thread
From: kernel test robot @ 2022-03-03 19:02 UTC (permalink / raw)
  To: kbuild

[-- Attachment #1: Type: text/plain, Size: 8963 bytes --]

CC: kbuild-all(a)lists.01.org
BCC: lkp(a)intel.com
CC: linux-kernel(a)vger.kernel.org
TO: Jake Wang <haonan.wang2@amd.com>
CC: Alex Deucher <alexander.deucher@amd.com>
CC: Aric Cyr <Aric.Cyr@amd.com>

tree:   https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master
head:   5859a2b1991101d6b978f3feb5325dad39421f29
commit: 06ddcee49a35981835e04910bef462a09f108984 drm/amd/display: Added multi instance support for panel control
date:   12 months ago
:::::: branch date: 19 hours ago
:::::: commit date: 12 months ago
config: powerpc-randconfig-m031-20220301 (https://download.01.org/0day-ci/archive/20220304/202203040239.BsQMEFBL-lkp(a)intel.com/config)
compiler: powerpc-linux-gcc (GCC) 11.2.0

If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp@intel.com>
Reported-by: Dan Carpenter <dan.carpenter@oracle.com>

smatch warnings:
drivers/gpu/drm/amd/amdgpu/../display/dc/dce110/dce110_hw_sequencer.c:1018 dce110_edp_backlight_control() error: we previously assumed 'link->panel_cntl' could be null (see line 977)

vim +1018 drivers/gpu/drm/amd/amdgpu/../display/dc/dce110/dce110_hw_sequencer.c

cf3a2627597794 Jun Lei           2020-11-24   957  
5eefbc40173644 Yue Hin Lau       2017-09-15   958  /*todo: cloned in stream enc, fix*/
5eefbc40173644 Yue Hin Lau       2017-09-15   959  /*
5eefbc40173644 Yue Hin Lau       2017-09-15   960   * @brief
5eefbc40173644 Yue Hin Lau       2017-09-15   961   * eDP only. Control the backlight of the eDP panel
5eefbc40173644 Yue Hin Lau       2017-09-15   962   */
8a31820b12187c Martin Leung      2019-07-09   963  void dce110_edp_backlight_control(
5eefbc40173644 Yue Hin Lau       2017-09-15   964  		struct dc_link *link,
5eefbc40173644 Yue Hin Lau       2017-09-15   965  		bool enable)
5eefbc40173644 Yue Hin Lau       2017-09-15   966  {
069d418f412ec4 Andrew Jiang      2017-09-26   967  	struct dc_context *ctx = link->ctx;
5eefbc40173644 Yue Hin Lau       2017-09-15   968  	struct bp_transmitter_control cntl = { 0 };
06ddcee49a3598 Jake Wang         2021-02-23   969  	uint8_t panel_instance;
5eefbc40173644 Yue Hin Lau       2017-09-15   970  
069d418f412ec4 Andrew Jiang      2017-09-26   971  	if (dal_graphics_object_id_get_connector_id(link->link_enc->connector)
5eefbc40173644 Yue Hin Lau       2017-09-15   972  		!= CONNECTOR_ID_EDP) {
5eefbc40173644 Yue Hin Lau       2017-09-15   973  		BREAK_TO_DEBUGGER();
5eefbc40173644 Yue Hin Lau       2017-09-15   974  		return;
5eefbc40173644 Yue Hin Lau       2017-09-15   975  	}
5eefbc40173644 Yue Hin Lau       2017-09-15   976  
014427adc5565a Sherry            2020-11-11  @977  	if (link->panel_cntl) {
014427adc5565a Sherry            2020-11-11   978  		bool is_backlight_on = link->panel_cntl->funcs->is_panel_backlight_on(link->panel_cntl);
014427adc5565a Sherry            2020-11-11   979  
014427adc5565a Sherry            2020-11-11   980  		if ((enable && is_backlight_on) || (!enable && !is_backlight_on)) {
1296423bf23c7a Bhawanpreet Lakha 2018-02-20   981  			DC_LOG_HW_RESUME_S3(
014427adc5565a Sherry            2020-11-11   982  				"%s: panel already powered up/off. Do nothing.\n",
5eefbc40173644 Yue Hin Lau       2017-09-15   983  				__func__);
5eefbc40173644 Yue Hin Lau       2017-09-15   984  			return;
5eefbc40173644 Yue Hin Lau       2017-09-15   985  		}
014427adc5565a Sherry            2020-11-11   986  	}
5eefbc40173644 Yue Hin Lau       2017-09-15   987  
5eefbc40173644 Yue Hin Lau       2017-09-15   988  	/* Send VBIOS command to control eDP panel backlight */
5eefbc40173644 Yue Hin Lau       2017-09-15   989  
1296423bf23c7a Bhawanpreet Lakha 2018-02-20   990  	DC_LOG_HW_RESUME_S3(
5eefbc40173644 Yue Hin Lau       2017-09-15   991  			"%s: backlight action: %s\n",
5eefbc40173644 Yue Hin Lau       2017-09-15   992  			__func__, (enable ? "On":"Off"));
5eefbc40173644 Yue Hin Lau       2017-09-15   993  
5eefbc40173644 Yue Hin Lau       2017-09-15   994  	cntl.action = enable ?
5eefbc40173644 Yue Hin Lau       2017-09-15   995  		TRANSMITTER_CONTROL_BACKLIGHT_ON :
5eefbc40173644 Yue Hin Lau       2017-09-15   996  		TRANSMITTER_CONTROL_BACKLIGHT_OFF;
8740196935625d Andrew Jiang      2017-09-25   997  
5eefbc40173644 Yue Hin Lau       2017-09-15   998  	/*cntl.engine_id = ctx->engine;*/
5eefbc40173644 Yue Hin Lau       2017-09-15   999  	cntl.transmitter = link->link_enc->transmitter;
5eefbc40173644 Yue Hin Lau       2017-09-15  1000  	cntl.connector_obj_id = link->link_enc->connector;
5eefbc40173644 Yue Hin Lau       2017-09-15  1001  	/*todo: unhardcode*/
5eefbc40173644 Yue Hin Lau       2017-09-15  1002  	cntl.lanes_number = LANE_COUNT_FOUR;
5eefbc40173644 Yue Hin Lau       2017-09-15  1003  	cntl.hpd_sel = link->link_enc->hpd_source;
cf1835f03ffb3b Charlene Liu      2018-01-08  1004  	cntl.signal = SIGNAL_TYPE_EDP;
5eefbc40173644 Yue Hin Lau       2017-09-15  1005  
5eefbc40173644 Yue Hin Lau       2017-09-15  1006  	/* For eDP, the following delays might need to be considered
5eefbc40173644 Yue Hin Lau       2017-09-15  1007  	 * after link training completed:
5eefbc40173644 Yue Hin Lau       2017-09-15  1008  	 * idle period - min. accounts for required BS-Idle pattern,
5eefbc40173644 Yue Hin Lau       2017-09-15  1009  	 * max. allows for source frame synchronization);
5eefbc40173644 Yue Hin Lau       2017-09-15  1010  	 * 50 msec max. delay from valid video data from source
5eefbc40173644 Yue Hin Lau       2017-09-15  1011  	 * to video on dislpay or backlight enable.
5eefbc40173644 Yue Hin Lau       2017-09-15  1012  	 *
5eefbc40173644 Yue Hin Lau       2017-09-15  1013  	 * Disable the delay for now.
5eefbc40173644 Yue Hin Lau       2017-09-15  1014  	 * Enable it in the future if necessary.
5eefbc40173644 Yue Hin Lau       2017-09-15  1015  	 */
5eefbc40173644 Yue Hin Lau       2017-09-15  1016  	/* dc_service_sleep_in_milliseconds(50); */
5180d4a4766d7d Charlene Liu      2018-01-18  1017  		/*edp 1.2*/
06ddcee49a3598 Jake Wang         2021-02-23 @1018  	panel_instance = link->panel_cntl->inst;
5180d4a4766d7d Charlene Liu      2018-01-18  1019  	if (cntl.action == TRANSMITTER_CONTROL_BACKLIGHT_ON)
5180d4a4766d7d Charlene Liu      2018-01-18  1020  		edp_receiver_ready_T7(link);
8a0e210c048e97 Chris Park        2020-08-05  1021  
8a0e210c048e97 Chris Park        2020-08-05  1022  	if (ctx->dc->ctx->dmub_srv &&
8a0e210c048e97 Chris Park        2020-08-05  1023  			ctx->dc->debug.dmub_command_table) {
8a0e210c048e97 Chris Park        2020-08-05  1024  		if (cntl.action == TRANSMITTER_CONTROL_BACKLIGHT_ON)
8a0e210c048e97 Chris Park        2020-08-05  1025  			ctx->dc_bios->funcs->enable_lvtma_control(ctx->dc_bios,
06ddcee49a3598 Jake Wang         2021-02-23  1026  					LVTMA_CONTROL_LCD_BLON,
06ddcee49a3598 Jake Wang         2021-02-23  1027  					panel_instance);
8a0e210c048e97 Chris Park        2020-08-05  1028  		else
8a0e210c048e97 Chris Park        2020-08-05  1029  			ctx->dc_bios->funcs->enable_lvtma_control(ctx->dc_bios,
06ddcee49a3598 Jake Wang         2021-02-23  1030  					LVTMA_CONTROL_LCD_BLOFF,
06ddcee49a3598 Jake Wang         2021-02-23  1031  					panel_instance);
8a0e210c048e97 Chris Park        2020-08-05  1032  	}
8a0e210c048e97 Chris Park        2020-08-05  1033  
069d418f412ec4 Andrew Jiang      2017-09-26  1034  	link_transmitter_control(ctx->dc_bios, &cntl);
96577cf82a1331 Hersen Wu         2020-01-14  1035  
96577cf82a1331 Hersen Wu         2020-01-14  1036  	if (enable && link->dpcd_sink_ext_caps.bits.oled)
96577cf82a1331 Hersen Wu         2020-01-14  1037  		msleep(OLED_POST_T7_DELAY);
96577cf82a1331 Hersen Wu         2020-01-14  1038  
96577cf82a1331 Hersen Wu         2020-01-14  1039  	if (link->dpcd_sink_ext_caps.bits.oled ||
96577cf82a1331 Hersen Wu         2020-01-14  1040  		link->dpcd_sink_ext_caps.bits.hdr_aux_backlight_control == 1 ||
96577cf82a1331 Hersen Wu         2020-01-14  1041  		link->dpcd_sink_ext_caps.bits.sdr_aux_backlight_control == 1)
96577cf82a1331 Hersen Wu         2020-01-14  1042  		dc_link_backlight_enable_aux(link, enable);
96577cf82a1331 Hersen Wu         2020-01-14  1043  
69b9723a81e74e Charlene Liu      2018-01-18  1044  	/*edp 1.2*/
5180d4a4766d7d Charlene Liu      2018-01-18  1045  	if (cntl.action == TRANSMITTER_CONTROL_BACKLIGHT_OFF)
3a372bed1e337e Hugo Hu           2020-10-06  1046  		edp_add_delay_for_T9(link);
96577cf82a1331 Hersen Wu         2020-01-14  1047  
96577cf82a1331 Hersen Wu         2020-01-14  1048  	if (!enable && link->dpcd_sink_ext_caps.bits.oled)
96577cf82a1331 Hersen Wu         2020-01-14  1049  		msleep(OLED_PRE_T11_DELAY);
5eefbc40173644 Yue Hin Lau       2017-09-15  1050  }
5eefbc40173644 Yue Hin Lau       2017-09-15  1051  

---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all(a)lists.01.org

^ permalink raw reply	[flat|nested] 10+ messages in thread

* drivers/gpu/drm/amd/amdgpu/../display/dc/dce110/dce110_hw_sequencer.c:1018 dce110_edp_backlight_control() error: we previously assumed 'link->panel_cntl' could be null (see line 977)
@ 2022-01-05  9:27 ` Dan Carpenter
  0 siblings, 0 replies; 10+ messages in thread
From: Dan Carpenter @ 2022-01-05  9:27 UTC (permalink / raw)
  To: kbuild, Jake Wang; +Cc: lkp, kbuild-all, linux-kernel, Alex Deucher, Aric Cyr

tree:   https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master
head:   5d65f6f3df56021ec76761ea6986bc8139f537d2
commit: 06ddcee49a35981835e04910bef462a09f108984 drm/amd/display: Added multi instance support for panel control
config: x86_64-randconfig-m001-20211207 (https://download.01.org/0day-ci/archive/20211218/202112181037.uydEtc7w-lkp@intel.com/config)
compiler: gcc-9 (Debian 9.3.0-22) 9.3.0

If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp@intel.com>
Reported-by: Dan Carpenter <dan.carpenter@oracle.com>

smatch warnings:
drivers/gpu/drm/amd/amdgpu/../display/dc/dce110/dce110_hw_sequencer.c:1018 dce110_edp_backlight_control() error: we previously assumed 'link->panel_cntl' could be null (see line 977)

vim +1018 drivers/gpu/drm/amd/amdgpu/../display/dc/dce110/dce110_hw_sequencer.c

8a31820b12187c Martin Leung      2019-07-09   963  void dce110_edp_backlight_control(
5eefbc40173644 Yue Hin Lau       2017-09-15   964  		struct dc_link *link,
5eefbc40173644 Yue Hin Lau       2017-09-15   965  		bool enable)
5eefbc40173644 Yue Hin Lau       2017-09-15   966  {
069d418f412ec4 Andrew Jiang      2017-09-26   967  	struct dc_context *ctx = link->ctx;
5eefbc40173644 Yue Hin Lau       2017-09-15   968  	struct bp_transmitter_control cntl = { 0 };
06ddcee49a3598 Jake Wang         2021-02-23   969  	uint8_t panel_instance;
5eefbc40173644 Yue Hin Lau       2017-09-15   970  
069d418f412ec4 Andrew Jiang      2017-09-26   971  	if (dal_graphics_object_id_get_connector_id(link->link_enc->connector)
5eefbc40173644 Yue Hin Lau       2017-09-15   972  		!= CONNECTOR_ID_EDP) {
5eefbc40173644 Yue Hin Lau       2017-09-15   973  		BREAK_TO_DEBUGGER();
5eefbc40173644 Yue Hin Lau       2017-09-15   974  		return;
5eefbc40173644 Yue Hin Lau       2017-09-15   975  	}
5eefbc40173644 Yue Hin Lau       2017-09-15   976  
014427adc5565a Sherry            2020-11-11  @977  	if (link->panel_cntl) {
                                                            ^^^^^^^^^^^^^^^^
Check for NULL

014427adc5565a Sherry            2020-11-11   978  		bool is_backlight_on = link->panel_cntl->funcs->is_panel_backlight_on(link->panel_cntl);
014427adc5565a Sherry            2020-11-11   979  
014427adc5565a Sherry            2020-11-11   980  		if ((enable && is_backlight_on) || (!enable && !is_backlight_on)) {
1296423bf23c7a Bhawanpreet Lakha 2018-02-20   981  			DC_LOG_HW_RESUME_S3(
014427adc5565a Sherry            2020-11-11   982  				"%s: panel already powered up/off. Do nothing.\n",
5eefbc40173644 Yue Hin Lau       2017-09-15   983  				__func__);
5eefbc40173644 Yue Hin Lau       2017-09-15   984  			return;
5eefbc40173644 Yue Hin Lau       2017-09-15   985  		}
014427adc5565a Sherry            2020-11-11   986  	}
5eefbc40173644 Yue Hin Lau       2017-09-15   987  
5eefbc40173644 Yue Hin Lau       2017-09-15   988  	/* Send VBIOS command to control eDP panel backlight */
5eefbc40173644 Yue Hin Lau       2017-09-15   989  
1296423bf23c7a Bhawanpreet Lakha 2018-02-20   990  	DC_LOG_HW_RESUME_S3(
5eefbc40173644 Yue Hin Lau       2017-09-15   991  			"%s: backlight action: %s\n",
5eefbc40173644 Yue Hin Lau       2017-09-15   992  			__func__, (enable ? "On":"Off"));
5eefbc40173644 Yue Hin Lau       2017-09-15   993  
5eefbc40173644 Yue Hin Lau       2017-09-15   994  	cntl.action = enable ?
5eefbc40173644 Yue Hin Lau       2017-09-15   995  		TRANSMITTER_CONTROL_BACKLIGHT_ON :
5eefbc40173644 Yue Hin Lau       2017-09-15   996  		TRANSMITTER_CONTROL_BACKLIGHT_OFF;
8740196935625d Andrew Jiang      2017-09-25   997  
5eefbc40173644 Yue Hin Lau       2017-09-15   998  	/*cntl.engine_id = ctx->engine;*/
5eefbc40173644 Yue Hin Lau       2017-09-15   999  	cntl.transmitter = link->link_enc->transmitter;
5eefbc40173644 Yue Hin Lau       2017-09-15  1000  	cntl.connector_obj_id = link->link_enc->connector;
5eefbc40173644 Yue Hin Lau       2017-09-15  1001  	/*todo: unhardcode*/
5eefbc40173644 Yue Hin Lau       2017-09-15  1002  	cntl.lanes_number = LANE_COUNT_FOUR;
5eefbc40173644 Yue Hin Lau       2017-09-15  1003  	cntl.hpd_sel = link->link_enc->hpd_source;
cf1835f03ffb3b Charlene Liu      2018-01-08  1004  	cntl.signal = SIGNAL_TYPE_EDP;
5eefbc40173644 Yue Hin Lau       2017-09-15  1005  
5eefbc40173644 Yue Hin Lau       2017-09-15  1006  	/* For eDP, the following delays might need to be considered
5eefbc40173644 Yue Hin Lau       2017-09-15  1007  	 * after link training completed:
5eefbc40173644 Yue Hin Lau       2017-09-15  1008  	 * idle period - min. accounts for required BS-Idle pattern,
5eefbc40173644 Yue Hin Lau       2017-09-15  1009  	 * max. allows for source frame synchronization);
5eefbc40173644 Yue Hin Lau       2017-09-15  1010  	 * 50 msec max. delay from valid video data from source
5eefbc40173644 Yue Hin Lau       2017-09-15  1011  	 * to video on dislpay or backlight enable.
5eefbc40173644 Yue Hin Lau       2017-09-15  1012  	 *
5eefbc40173644 Yue Hin Lau       2017-09-15  1013  	 * Disable the delay for now.
5eefbc40173644 Yue Hin Lau       2017-09-15  1014  	 * Enable it in the future if necessary.
5eefbc40173644 Yue Hin Lau       2017-09-15  1015  	 */
5eefbc40173644 Yue Hin Lau       2017-09-15  1016  	/* dc_service_sleep_in_milliseconds(50); */
5180d4a4766d7d Charlene Liu      2018-01-18  1017  		/*edp 1.2*/
06ddcee49a3598 Jake Wang         2021-02-23 @1018  	panel_instance = link->panel_cntl->inst;
                                                                         ^^^^^^^^^^^^^^^^^^
Unchecked dereference.

5180d4a4766d7d Charlene Liu      2018-01-18  1019  	if (cntl.action == TRANSMITTER_CONTROL_BACKLIGHT_ON)
5180d4a4766d7d Charlene Liu      2018-01-18  1020  		edp_receiver_ready_T7(link);
8a0e210c048e97 Chris Park        2020-08-05  1021  
8a0e210c048e97 Chris Park        2020-08-05  1022  	if (ctx->dc->ctx->dmub_srv &&
8a0e210c048e97 Chris Park        2020-08-05  1023  			ctx->dc->debug.dmub_command_table) {
8a0e210c048e97 Chris Park        2020-08-05  1024  		if (cntl.action == TRANSMITTER_CONTROL_BACKLIGHT_ON)
8a0e210c048e97 Chris Park        2020-08-05  1025  			ctx->dc_bios->funcs->enable_lvtma_control(ctx->dc_bios,
06ddcee49a3598 Jake Wang         2021-02-23  1026  					LVTMA_CONTROL_LCD_BLON,
06ddcee49a3598 Jake Wang         2021-02-23  1027  					panel_instance);
8a0e210c048e97 Chris Park        2020-08-05  1028  		else
8a0e210c048e97 Chris Park        2020-08-05  1029  			ctx->dc_bios->funcs->enable_lvtma_control(ctx->dc_bios,
06ddcee49a3598 Jake Wang         2021-02-23  1030  					LVTMA_CONTROL_LCD_BLOFF,
06ddcee49a3598 Jake Wang         2021-02-23  1031  					panel_instance);
8a0e210c048e97 Chris Park        2020-08-05  1032  	}
8a0e210c048e97 Chris Park        2020-08-05  1033  
069d418f412ec4 Andrew Jiang      2017-09-26  1034  	link_transmitter_control(ctx->dc_bios, &cntl);
96577cf82a1331 Hersen Wu         2020-01-14  1035  
96577cf82a1331 Hersen Wu         2020-01-14  1036  	if (enable && link->dpcd_sink_ext_caps.bits.oled)
96577cf82a1331 Hersen Wu         2020-01-14  1037  		msleep(OLED_POST_T7_DELAY);
96577cf82a1331 Hersen Wu         2020-01-14  1038  
96577cf82a1331 Hersen Wu         2020-01-14  1039  	if (link->dpcd_sink_ext_caps.bits.oled ||
96577cf82a1331 Hersen Wu         2020-01-14  1040  		link->dpcd_sink_ext_caps.bits.hdr_aux_backlight_control == 1 ||
96577cf82a1331 Hersen Wu         2020-01-14  1041  		link->dpcd_sink_ext_caps.bits.sdr_aux_backlight_control == 1)
96577cf82a1331 Hersen Wu         2020-01-14  1042  		dc_link_backlight_enable_aux(link, enable);
96577cf82a1331 Hersen Wu         2020-01-14  1043  
69b9723a81e74e Charlene Liu      2018-01-18  1044  	/*edp 1.2*/
5180d4a4766d7d Charlene Liu      2018-01-18  1045  	if (cntl.action == TRANSMITTER_CONTROL_BACKLIGHT_OFF)
3a372bed1e337e Hugo Hu           2020-10-06  1046  		edp_add_delay_for_T9(link);
96577cf82a1331 Hersen Wu         2020-01-14  1047  
96577cf82a1331 Hersen Wu         2020-01-14  1048  	if (!enable && link->dpcd_sink_ext_caps.bits.oled)
96577cf82a1331 Hersen Wu         2020-01-14  1049  		msleep(OLED_PRE_T11_DELAY);
5eefbc40173644 Yue Hin Lau       2017-09-15  1050  }

---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all@lists.01.org


^ permalink raw reply	[flat|nested] 10+ messages in thread

* drivers/gpu/drm/amd/amdgpu/../display/dc/dce110/dce110_hw_sequencer.c:1018 dce110_edp_backlight_control() error: we previously assumed 'link->panel_cntl' could be null (see line 977)
@ 2022-01-05  9:27 ` Dan Carpenter
  0 siblings, 0 replies; 10+ messages in thread
From: Dan Carpenter @ 2022-01-05  9:27 UTC (permalink / raw)
  To: kbuild-all

[-- Attachment #1: Type: text/plain, Size: 8407 bytes --]

tree:   https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master
head:   5d65f6f3df56021ec76761ea6986bc8139f537d2
commit: 06ddcee49a35981835e04910bef462a09f108984 drm/amd/display: Added multi instance support for panel control
config: x86_64-randconfig-m001-20211207 (https://download.01.org/0day-ci/archive/20211218/202112181037.uydEtc7w-lkp(a)intel.com/config)
compiler: gcc-9 (Debian 9.3.0-22) 9.3.0

If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp@intel.com>
Reported-by: Dan Carpenter <dan.carpenter@oracle.com>

smatch warnings:
drivers/gpu/drm/amd/amdgpu/../display/dc/dce110/dce110_hw_sequencer.c:1018 dce110_edp_backlight_control() error: we previously assumed 'link->panel_cntl' could be null (see line 977)

vim +1018 drivers/gpu/drm/amd/amdgpu/../display/dc/dce110/dce110_hw_sequencer.c

8a31820b12187c Martin Leung      2019-07-09   963  void dce110_edp_backlight_control(
5eefbc40173644 Yue Hin Lau       2017-09-15   964  		struct dc_link *link,
5eefbc40173644 Yue Hin Lau       2017-09-15   965  		bool enable)
5eefbc40173644 Yue Hin Lau       2017-09-15   966  {
069d418f412ec4 Andrew Jiang      2017-09-26   967  	struct dc_context *ctx = link->ctx;
5eefbc40173644 Yue Hin Lau       2017-09-15   968  	struct bp_transmitter_control cntl = { 0 };
06ddcee49a3598 Jake Wang         2021-02-23   969  	uint8_t panel_instance;
5eefbc40173644 Yue Hin Lau       2017-09-15   970  
069d418f412ec4 Andrew Jiang      2017-09-26   971  	if (dal_graphics_object_id_get_connector_id(link->link_enc->connector)
5eefbc40173644 Yue Hin Lau       2017-09-15   972  		!= CONNECTOR_ID_EDP) {
5eefbc40173644 Yue Hin Lau       2017-09-15   973  		BREAK_TO_DEBUGGER();
5eefbc40173644 Yue Hin Lau       2017-09-15   974  		return;
5eefbc40173644 Yue Hin Lau       2017-09-15   975  	}
5eefbc40173644 Yue Hin Lau       2017-09-15   976  
014427adc5565a Sherry            2020-11-11  @977  	if (link->panel_cntl) {
                                                            ^^^^^^^^^^^^^^^^
Check for NULL

014427adc5565a Sherry            2020-11-11   978  		bool is_backlight_on = link->panel_cntl->funcs->is_panel_backlight_on(link->panel_cntl);
014427adc5565a Sherry            2020-11-11   979  
014427adc5565a Sherry            2020-11-11   980  		if ((enable && is_backlight_on) || (!enable && !is_backlight_on)) {
1296423bf23c7a Bhawanpreet Lakha 2018-02-20   981  			DC_LOG_HW_RESUME_S3(
014427adc5565a Sherry            2020-11-11   982  				"%s: panel already powered up/off. Do nothing.\n",
5eefbc40173644 Yue Hin Lau       2017-09-15   983  				__func__);
5eefbc40173644 Yue Hin Lau       2017-09-15   984  			return;
5eefbc40173644 Yue Hin Lau       2017-09-15   985  		}
014427adc5565a Sherry            2020-11-11   986  	}
5eefbc40173644 Yue Hin Lau       2017-09-15   987  
5eefbc40173644 Yue Hin Lau       2017-09-15   988  	/* Send VBIOS command to control eDP panel backlight */
5eefbc40173644 Yue Hin Lau       2017-09-15   989  
1296423bf23c7a Bhawanpreet Lakha 2018-02-20   990  	DC_LOG_HW_RESUME_S3(
5eefbc40173644 Yue Hin Lau       2017-09-15   991  			"%s: backlight action: %s\n",
5eefbc40173644 Yue Hin Lau       2017-09-15   992  			__func__, (enable ? "On":"Off"));
5eefbc40173644 Yue Hin Lau       2017-09-15   993  
5eefbc40173644 Yue Hin Lau       2017-09-15   994  	cntl.action = enable ?
5eefbc40173644 Yue Hin Lau       2017-09-15   995  		TRANSMITTER_CONTROL_BACKLIGHT_ON :
5eefbc40173644 Yue Hin Lau       2017-09-15   996  		TRANSMITTER_CONTROL_BACKLIGHT_OFF;
8740196935625d Andrew Jiang      2017-09-25   997  
5eefbc40173644 Yue Hin Lau       2017-09-15   998  	/*cntl.engine_id = ctx->engine;*/
5eefbc40173644 Yue Hin Lau       2017-09-15   999  	cntl.transmitter = link->link_enc->transmitter;
5eefbc40173644 Yue Hin Lau       2017-09-15  1000  	cntl.connector_obj_id = link->link_enc->connector;
5eefbc40173644 Yue Hin Lau       2017-09-15  1001  	/*todo: unhardcode*/
5eefbc40173644 Yue Hin Lau       2017-09-15  1002  	cntl.lanes_number = LANE_COUNT_FOUR;
5eefbc40173644 Yue Hin Lau       2017-09-15  1003  	cntl.hpd_sel = link->link_enc->hpd_source;
cf1835f03ffb3b Charlene Liu      2018-01-08  1004  	cntl.signal = SIGNAL_TYPE_EDP;
5eefbc40173644 Yue Hin Lau       2017-09-15  1005  
5eefbc40173644 Yue Hin Lau       2017-09-15  1006  	/* For eDP, the following delays might need to be considered
5eefbc40173644 Yue Hin Lau       2017-09-15  1007  	 * after link training completed:
5eefbc40173644 Yue Hin Lau       2017-09-15  1008  	 * idle period - min. accounts for required BS-Idle pattern,
5eefbc40173644 Yue Hin Lau       2017-09-15  1009  	 * max. allows for source frame synchronization);
5eefbc40173644 Yue Hin Lau       2017-09-15  1010  	 * 50 msec max. delay from valid video data from source
5eefbc40173644 Yue Hin Lau       2017-09-15  1011  	 * to video on dislpay or backlight enable.
5eefbc40173644 Yue Hin Lau       2017-09-15  1012  	 *
5eefbc40173644 Yue Hin Lau       2017-09-15  1013  	 * Disable the delay for now.
5eefbc40173644 Yue Hin Lau       2017-09-15  1014  	 * Enable it in the future if necessary.
5eefbc40173644 Yue Hin Lau       2017-09-15  1015  	 */
5eefbc40173644 Yue Hin Lau       2017-09-15  1016  	/* dc_service_sleep_in_milliseconds(50); */
5180d4a4766d7d Charlene Liu      2018-01-18  1017  		/*edp 1.2*/
06ddcee49a3598 Jake Wang         2021-02-23 @1018  	panel_instance = link->panel_cntl->inst;
                                                                         ^^^^^^^^^^^^^^^^^^
Unchecked dereference.

5180d4a4766d7d Charlene Liu      2018-01-18  1019  	if (cntl.action == TRANSMITTER_CONTROL_BACKLIGHT_ON)
5180d4a4766d7d Charlene Liu      2018-01-18  1020  		edp_receiver_ready_T7(link);
8a0e210c048e97 Chris Park        2020-08-05  1021  
8a0e210c048e97 Chris Park        2020-08-05  1022  	if (ctx->dc->ctx->dmub_srv &&
8a0e210c048e97 Chris Park        2020-08-05  1023  			ctx->dc->debug.dmub_command_table) {
8a0e210c048e97 Chris Park        2020-08-05  1024  		if (cntl.action == TRANSMITTER_CONTROL_BACKLIGHT_ON)
8a0e210c048e97 Chris Park        2020-08-05  1025  			ctx->dc_bios->funcs->enable_lvtma_control(ctx->dc_bios,
06ddcee49a3598 Jake Wang         2021-02-23  1026  					LVTMA_CONTROL_LCD_BLON,
06ddcee49a3598 Jake Wang         2021-02-23  1027  					panel_instance);
8a0e210c048e97 Chris Park        2020-08-05  1028  		else
8a0e210c048e97 Chris Park        2020-08-05  1029  			ctx->dc_bios->funcs->enable_lvtma_control(ctx->dc_bios,
06ddcee49a3598 Jake Wang         2021-02-23  1030  					LVTMA_CONTROL_LCD_BLOFF,
06ddcee49a3598 Jake Wang         2021-02-23  1031  					panel_instance);
8a0e210c048e97 Chris Park        2020-08-05  1032  	}
8a0e210c048e97 Chris Park        2020-08-05  1033  
069d418f412ec4 Andrew Jiang      2017-09-26  1034  	link_transmitter_control(ctx->dc_bios, &cntl);
96577cf82a1331 Hersen Wu         2020-01-14  1035  
96577cf82a1331 Hersen Wu         2020-01-14  1036  	if (enable && link->dpcd_sink_ext_caps.bits.oled)
96577cf82a1331 Hersen Wu         2020-01-14  1037  		msleep(OLED_POST_T7_DELAY);
96577cf82a1331 Hersen Wu         2020-01-14  1038  
96577cf82a1331 Hersen Wu         2020-01-14  1039  	if (link->dpcd_sink_ext_caps.bits.oled ||
96577cf82a1331 Hersen Wu         2020-01-14  1040  		link->dpcd_sink_ext_caps.bits.hdr_aux_backlight_control == 1 ||
96577cf82a1331 Hersen Wu         2020-01-14  1041  		link->dpcd_sink_ext_caps.bits.sdr_aux_backlight_control == 1)
96577cf82a1331 Hersen Wu         2020-01-14  1042  		dc_link_backlight_enable_aux(link, enable);
96577cf82a1331 Hersen Wu         2020-01-14  1043  
69b9723a81e74e Charlene Liu      2018-01-18  1044  	/*edp 1.2*/
5180d4a4766d7d Charlene Liu      2018-01-18  1045  	if (cntl.action == TRANSMITTER_CONTROL_BACKLIGHT_OFF)
3a372bed1e337e Hugo Hu           2020-10-06  1046  		edp_add_delay_for_T9(link);
96577cf82a1331 Hersen Wu         2020-01-14  1047  
96577cf82a1331 Hersen Wu         2020-01-14  1048  	if (!enable && link->dpcd_sink_ext_caps.bits.oled)
96577cf82a1331 Hersen Wu         2020-01-14  1049  		msleep(OLED_PRE_T11_DELAY);
5eefbc40173644 Yue Hin Lau       2017-09-15  1050  }

---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all(a)lists.01.org

^ permalink raw reply	[flat|nested] 10+ messages in thread

* drivers/gpu/drm/amd/amdgpu/../display/dc/dce110/dce110_hw_sequencer.c:1018 dce110_edp_backlight_control() error: we previously assumed 'link->panel_cntl' could be null (see line 977)
@ 2022-01-05  9:27 ` Dan Carpenter
  0 siblings, 0 replies; 10+ messages in thread
From: kernel test robot @ 2021-12-18  2:29 UTC (permalink / raw)
  To: kbuild

[-- Attachment #1: Type: text/plain, Size: 8936 bytes --]

CC: kbuild-all(a)lists.01.org
CC: linux-kernel(a)vger.kernel.org
TO: Jake Wang <haonan.wang2@amd.com>
CC: Alex Deucher <alexander.deucher@amd.com>
CC: Aric Cyr <Aric.Cyr@amd.com>

tree:   https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master
head:   5d65f6f3df56021ec76761ea6986bc8139f537d2
commit: 06ddcee49a35981835e04910bef462a09f108984 drm/amd/display: Added multi instance support for panel control
date:   9 months ago
:::::: branch date: 5 hours ago
:::::: commit date: 9 months ago
config: x86_64-randconfig-m001-20211207 (https://download.01.org/0day-ci/archive/20211218/202112181037.uydEtc7w-lkp(a)intel.com/config)
compiler: gcc-9 (Debian 9.3.0-22) 9.3.0

If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp@intel.com>
Reported-by: Dan Carpenter <dan.carpenter@oracle.com>

smatch warnings:
drivers/gpu/drm/amd/amdgpu/../display/dc/dce110/dce110_hw_sequencer.c:1018 dce110_edp_backlight_control() error: we previously assumed 'link->panel_cntl' could be null (see line 977)

vim +1018 drivers/gpu/drm/amd/amdgpu/../display/dc/dce110/dce110_hw_sequencer.c

cf3a2627597794 Jun Lei           2020-11-24   957  
5eefbc40173644 Yue Hin Lau       2017-09-15   958  /*todo: cloned in stream enc, fix*/
5eefbc40173644 Yue Hin Lau       2017-09-15   959  /*
5eefbc40173644 Yue Hin Lau       2017-09-15   960   * @brief
5eefbc40173644 Yue Hin Lau       2017-09-15   961   * eDP only. Control the backlight of the eDP panel
5eefbc40173644 Yue Hin Lau       2017-09-15   962   */
8a31820b12187c Martin Leung      2019-07-09   963  void dce110_edp_backlight_control(
5eefbc40173644 Yue Hin Lau       2017-09-15   964  		struct dc_link *link,
5eefbc40173644 Yue Hin Lau       2017-09-15   965  		bool enable)
5eefbc40173644 Yue Hin Lau       2017-09-15   966  {
069d418f412ec4 Andrew Jiang      2017-09-26   967  	struct dc_context *ctx = link->ctx;
5eefbc40173644 Yue Hin Lau       2017-09-15   968  	struct bp_transmitter_control cntl = { 0 };
06ddcee49a3598 Jake Wang         2021-02-23   969  	uint8_t panel_instance;
5eefbc40173644 Yue Hin Lau       2017-09-15   970  
069d418f412ec4 Andrew Jiang      2017-09-26   971  	if (dal_graphics_object_id_get_connector_id(link->link_enc->connector)
5eefbc40173644 Yue Hin Lau       2017-09-15   972  		!= CONNECTOR_ID_EDP) {
5eefbc40173644 Yue Hin Lau       2017-09-15   973  		BREAK_TO_DEBUGGER();
5eefbc40173644 Yue Hin Lau       2017-09-15   974  		return;
5eefbc40173644 Yue Hin Lau       2017-09-15   975  	}
5eefbc40173644 Yue Hin Lau       2017-09-15   976  
014427adc5565a Sherry            2020-11-11  @977  	if (link->panel_cntl) {
014427adc5565a Sherry            2020-11-11   978  		bool is_backlight_on = link->panel_cntl->funcs->is_panel_backlight_on(link->panel_cntl);
014427adc5565a Sherry            2020-11-11   979  
014427adc5565a Sherry            2020-11-11   980  		if ((enable && is_backlight_on) || (!enable && !is_backlight_on)) {
1296423bf23c7a Bhawanpreet Lakha 2018-02-20   981  			DC_LOG_HW_RESUME_S3(
014427adc5565a Sherry            2020-11-11   982  				"%s: panel already powered up/off. Do nothing.\n",
5eefbc40173644 Yue Hin Lau       2017-09-15   983  				__func__);
5eefbc40173644 Yue Hin Lau       2017-09-15   984  			return;
5eefbc40173644 Yue Hin Lau       2017-09-15   985  		}
014427adc5565a Sherry            2020-11-11   986  	}
5eefbc40173644 Yue Hin Lau       2017-09-15   987  
5eefbc40173644 Yue Hin Lau       2017-09-15   988  	/* Send VBIOS command to control eDP panel backlight */
5eefbc40173644 Yue Hin Lau       2017-09-15   989  
1296423bf23c7a Bhawanpreet Lakha 2018-02-20   990  	DC_LOG_HW_RESUME_S3(
5eefbc40173644 Yue Hin Lau       2017-09-15   991  			"%s: backlight action: %s\n",
5eefbc40173644 Yue Hin Lau       2017-09-15   992  			__func__, (enable ? "On":"Off"));
5eefbc40173644 Yue Hin Lau       2017-09-15   993  
5eefbc40173644 Yue Hin Lau       2017-09-15   994  	cntl.action = enable ?
5eefbc40173644 Yue Hin Lau       2017-09-15   995  		TRANSMITTER_CONTROL_BACKLIGHT_ON :
5eefbc40173644 Yue Hin Lau       2017-09-15   996  		TRANSMITTER_CONTROL_BACKLIGHT_OFF;
8740196935625d Andrew Jiang      2017-09-25   997  
5eefbc40173644 Yue Hin Lau       2017-09-15   998  	/*cntl.engine_id = ctx->engine;*/
5eefbc40173644 Yue Hin Lau       2017-09-15   999  	cntl.transmitter = link->link_enc->transmitter;
5eefbc40173644 Yue Hin Lau       2017-09-15  1000  	cntl.connector_obj_id = link->link_enc->connector;
5eefbc40173644 Yue Hin Lau       2017-09-15  1001  	/*todo: unhardcode*/
5eefbc40173644 Yue Hin Lau       2017-09-15  1002  	cntl.lanes_number = LANE_COUNT_FOUR;
5eefbc40173644 Yue Hin Lau       2017-09-15  1003  	cntl.hpd_sel = link->link_enc->hpd_source;
cf1835f03ffb3b Charlene Liu      2018-01-08  1004  	cntl.signal = SIGNAL_TYPE_EDP;
5eefbc40173644 Yue Hin Lau       2017-09-15  1005  
5eefbc40173644 Yue Hin Lau       2017-09-15  1006  	/* For eDP, the following delays might need to be considered
5eefbc40173644 Yue Hin Lau       2017-09-15  1007  	 * after link training completed:
5eefbc40173644 Yue Hin Lau       2017-09-15  1008  	 * idle period - min. accounts for required BS-Idle pattern,
5eefbc40173644 Yue Hin Lau       2017-09-15  1009  	 * max. allows for source frame synchronization);
5eefbc40173644 Yue Hin Lau       2017-09-15  1010  	 * 50 msec max. delay from valid video data from source
5eefbc40173644 Yue Hin Lau       2017-09-15  1011  	 * to video on dislpay or backlight enable.
5eefbc40173644 Yue Hin Lau       2017-09-15  1012  	 *
5eefbc40173644 Yue Hin Lau       2017-09-15  1013  	 * Disable the delay for now.
5eefbc40173644 Yue Hin Lau       2017-09-15  1014  	 * Enable it in the future if necessary.
5eefbc40173644 Yue Hin Lau       2017-09-15  1015  	 */
5eefbc40173644 Yue Hin Lau       2017-09-15  1016  	/* dc_service_sleep_in_milliseconds(50); */
5180d4a4766d7d Charlene Liu      2018-01-18  1017  		/*edp 1.2*/
06ddcee49a3598 Jake Wang         2021-02-23 @1018  	panel_instance = link->panel_cntl->inst;
5180d4a4766d7d Charlene Liu      2018-01-18  1019  	if (cntl.action == TRANSMITTER_CONTROL_BACKLIGHT_ON)
5180d4a4766d7d Charlene Liu      2018-01-18  1020  		edp_receiver_ready_T7(link);
8a0e210c048e97 Chris Park        2020-08-05  1021  
8a0e210c048e97 Chris Park        2020-08-05  1022  	if (ctx->dc->ctx->dmub_srv &&
8a0e210c048e97 Chris Park        2020-08-05  1023  			ctx->dc->debug.dmub_command_table) {
8a0e210c048e97 Chris Park        2020-08-05  1024  		if (cntl.action == TRANSMITTER_CONTROL_BACKLIGHT_ON)
8a0e210c048e97 Chris Park        2020-08-05  1025  			ctx->dc_bios->funcs->enable_lvtma_control(ctx->dc_bios,
06ddcee49a3598 Jake Wang         2021-02-23  1026  					LVTMA_CONTROL_LCD_BLON,
06ddcee49a3598 Jake Wang         2021-02-23  1027  					panel_instance);
8a0e210c048e97 Chris Park        2020-08-05  1028  		else
8a0e210c048e97 Chris Park        2020-08-05  1029  			ctx->dc_bios->funcs->enable_lvtma_control(ctx->dc_bios,
06ddcee49a3598 Jake Wang         2021-02-23  1030  					LVTMA_CONTROL_LCD_BLOFF,
06ddcee49a3598 Jake Wang         2021-02-23  1031  					panel_instance);
8a0e210c048e97 Chris Park        2020-08-05  1032  	}
8a0e210c048e97 Chris Park        2020-08-05  1033  
069d418f412ec4 Andrew Jiang      2017-09-26  1034  	link_transmitter_control(ctx->dc_bios, &cntl);
96577cf82a1331 Hersen Wu         2020-01-14  1035  
96577cf82a1331 Hersen Wu         2020-01-14  1036  	if (enable && link->dpcd_sink_ext_caps.bits.oled)
96577cf82a1331 Hersen Wu         2020-01-14  1037  		msleep(OLED_POST_T7_DELAY);
96577cf82a1331 Hersen Wu         2020-01-14  1038  
96577cf82a1331 Hersen Wu         2020-01-14  1039  	if (link->dpcd_sink_ext_caps.bits.oled ||
96577cf82a1331 Hersen Wu         2020-01-14  1040  		link->dpcd_sink_ext_caps.bits.hdr_aux_backlight_control == 1 ||
96577cf82a1331 Hersen Wu         2020-01-14  1041  		link->dpcd_sink_ext_caps.bits.sdr_aux_backlight_control == 1)
96577cf82a1331 Hersen Wu         2020-01-14  1042  		dc_link_backlight_enable_aux(link, enable);
96577cf82a1331 Hersen Wu         2020-01-14  1043  
69b9723a81e74e Charlene Liu      2018-01-18  1044  	/*edp 1.2*/
5180d4a4766d7d Charlene Liu      2018-01-18  1045  	if (cntl.action == TRANSMITTER_CONTROL_BACKLIGHT_OFF)
3a372bed1e337e Hugo Hu           2020-10-06  1046  		edp_add_delay_for_T9(link);
96577cf82a1331 Hersen Wu         2020-01-14  1047  
96577cf82a1331 Hersen Wu         2020-01-14  1048  	if (!enable && link->dpcd_sink_ext_caps.bits.oled)
96577cf82a1331 Hersen Wu         2020-01-14  1049  		msleep(OLED_PRE_T11_DELAY);
5eefbc40173644 Yue Hin Lau       2017-09-15  1050  }
5eefbc40173644 Yue Hin Lau       2017-09-15  1051  

---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all(a)lists.01.org

^ permalink raw reply	[flat|nested] 10+ messages in thread

end of thread, other threads:[~2022-03-09 10:31 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-03-01 17:28 drivers/gpu/drm/amd/amdgpu/../display/dc/dce110/dce110_hw_sequencer.c:1018 dce110_edp_backlight_control() error: we previously assumed 'link->panel_cntl' could be null (see line 977) kernel test robot
2022-03-03 11:46 ` Dan Carpenter
2022-03-03 11:46 ` Dan Carpenter
  -- strict thread matches above, loose matches on Subject: below --
2022-03-09 10:31 Dan Carpenter
2022-03-09  7:32 ` kernel test robot
2022-03-09 10:31 ` Dan Carpenter
2022-03-03 19:02 kernel test robot
2022-01-05  9:27 Dan Carpenter
2021-12-18  2:29 ` kernel test robot
2022-01-05  9:27 ` Dan Carpenter

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.