All of lore.kernel.org
 help / color / mirror / Atom feed
* [agd5f:amd-staging-drm-next 1968/1993] 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)
@ 2021-03-10 15:32 kernel test robot
  0 siblings, 0 replies; 3+ messages in thread
From: kernel test robot @ 2021-03-10 15:32 UTC (permalink / raw)
  To: kbuild

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

CC: kbuild-all(a)lists.01.org
TO: Jake Wang <haonan.wang2@amd.com>
CC: Gerrit Cr <Gerrit.Cr@amd.com>
CC: Aric Cyr <Aric.Cyr@amd.com>

tree:   https://gitlab.freedesktop.org/agd5f/linux.git amd-staging-drm-next
head:   dec2310256916626e4356af784822e02fb807cad
commit: c798c69be8e82c97897a8b6fa4fd8a55624a1509 [1968/1993] drm/amd/display: Added multi instance support for panel control
:::::: branch date: 14 hours ago
:::::: commit date: 2 days ago
config: x86_64-randconfig-m001-20210309 (attached as .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 };
c798c69be8e82c 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*/
c798c69be8e82c 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,
c798c69be8e82c Jake Wang         2021-02-23  1026  					LVTMA_CONTROL_LCD_BLON,
c798c69be8e82c 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,
c798c69be8e82c Jake Wang         2021-02-23  1030  					LVTMA_CONTROL_LCD_BLOFF,
c798c69be8e82c 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

[-- Attachment #2: config.gz --]
[-- Type: application/gzip, Size: 41143 bytes --]

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

* [agd5f:amd-staging-drm-next 1968/1993] 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)
@ 2021-03-10 17:46 ` Dan Carpenter
  0 siblings, 0 replies; 3+ messages in thread
From: Dan Carpenter @ 2021-03-10 17:46 UTC (permalink / raw)
  To: kbuild

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

tree:   https://gitlab.freedesktop.org/agd5f/linux.git amd-staging-drm-next
head:   dec2310256916626e4356af784822e02fb807cad
commit: c798c69be8e82c97897a8b6fa4fd8a55624a1509 [1968/1993] drm/amd/display: Added multi instance support for panel control
config: x86_64-randconfig-m001-20210309 (attached as .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 };
c798c69be8e82c 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) {
                                                            ^^^^^^^^^^^^^^^^
This code assumes "link->panel_cntl" can be 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*/
c798c69be8e82c Jake Wang         2021-02-23 @1018  	panel_instance = link->panel_cntl->inst;
                                                                         ^^^^^^^^^^^^^^^^

This code dereferences it without checking.

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,
c798c69be8e82c Jake Wang         2021-02-23  1026  					LVTMA_CONTROL_LCD_BLON,
c798c69be8e82c 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,
c798c69be8e82c Jake Wang         2021-02-23  1030  					LVTMA_CONTROL_LCD_BLOFF,
c798c69be8e82c 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

[-- Attachment #2: config.gz --]
[-- Type: application/gzip, Size: 41143 bytes --]

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

* [agd5f:amd-staging-drm-next 1968/1993] 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)
@ 2021-03-10 17:46 ` Dan Carpenter
  0 siblings, 0 replies; 3+ messages in thread
From: Dan Carpenter @ 2021-03-10 17:46 UTC (permalink / raw)
  To: kbuild-all

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

tree:   https://gitlab.freedesktop.org/agd5f/linux.git amd-staging-drm-next
head:   dec2310256916626e4356af784822e02fb807cad
commit: c798c69be8e82c97897a8b6fa4fd8a55624a1509 [1968/1993] drm/amd/display: Added multi instance support for panel control
config: x86_64-randconfig-m001-20210309 (attached as .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 };
c798c69be8e82c 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) {
                                                            ^^^^^^^^^^^^^^^^
This code assumes "link->panel_cntl" can be 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*/
c798c69be8e82c Jake Wang         2021-02-23 @1018  	panel_instance = link->panel_cntl->inst;
                                                                         ^^^^^^^^^^^^^^^^

This code dereferences it without checking.

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,
c798c69be8e82c Jake Wang         2021-02-23  1026  					LVTMA_CONTROL_LCD_BLON,
c798c69be8e82c 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,
c798c69be8e82c Jake Wang         2021-02-23  1030  					LVTMA_CONTROL_LCD_BLOFF,
c798c69be8e82c 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

[-- Attachment #2: config.gz --]
[-- Type: application/gzip, Size: 41143 bytes --]

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

end of thread, other threads:[~2021-03-10 17:46 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-03-10 15:32 [agd5f:amd-staging-drm-next 1968/1993] 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
2021-03-10 17:46 Dan Carpenter
2021-03-10 17:46 ` 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.