[Intel-gfx] [kbuild] Re: [PATCH v2 04/13] drm/hdcp: Expand HDCP helper library for enable/disable/check
Dan Carpenter
dan.carpenter at oracle.com
Fri Sep 17 10:58:45 UTC 2021
Hi Sean,
url: https://github.com/0day-ci/linux/commits/Sean-Paul/drm-hdcp-Pull-HDCP-auth-exchange-check-into-helpers/20210916-044145
base: git://anongit.freedesktop.org/drm-intel for-linux-next
config: x86_64-randconfig-m001-20210916 (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 at intel.com>
Reported-by: Dan Carpenter <dan.carpenter at oracle.com>
New smatch warnings:
drivers/gpu/drm/drm_hdcp.c:1208 drm_hdcp_helper_enable_hdcp() error: uninitialized symbol 'check_link_interval'.
Old smatch warnings:
drivers/gpu/drm/drm_hdcp.c:514 drm_hdcp_atomic_check() warn: inconsistent indenting
vim +/check_link_interval +1208 drivers/gpu/drm/drm_hdcp.c
cbc5065be3a652f Sean Paul 2021-09-15 1127 static int drm_hdcp_helper_enable_hdcp(struct drm_hdcp_helper_data *data,
cbc5065be3a652f Sean Paul 2021-09-15 1128 struct drm_atomic_state *state,
cbc5065be3a652f Sean Paul 2021-09-15 1129 struct mutex *driver_mutex)
cbc5065be3a652f Sean Paul 2021-09-15 1130 {
cbc5065be3a652f Sean Paul 2021-09-15 1131 struct drm_connector *connector = data->connector;
cbc5065be3a652f Sean Paul 2021-09-15 1132 struct drm_connector_state *conn_state;
cbc5065be3a652f Sean Paul 2021-09-15 1133 struct drm_device *dev = connector->dev;
cbc5065be3a652f Sean Paul 2021-09-15 1134 unsigned long check_link_interval;
^^^^^^^^^^^^^^^^^^^
cbc5065be3a652f Sean Paul 2021-09-15 1135 bool capable;
cbc5065be3a652f Sean Paul 2021-09-15 1136 int ret = 0;
cbc5065be3a652f Sean Paul 2021-09-15 1137
cbc5065be3a652f Sean Paul 2021-09-15 1138 conn_state = drm_atomic_get_new_connector_state(state, connector);
cbc5065be3a652f Sean Paul 2021-09-15 1139
cbc5065be3a652f Sean Paul 2021-09-15 1140 mutex_lock(&data->mutex);
cbc5065be3a652f Sean Paul 2021-09-15 1141
cbc5065be3a652f Sean Paul 2021-09-15 1142 if (data->value == DRM_MODE_CONTENT_PROTECTION_ENABLED) {
cbc5065be3a652f Sean Paul 2021-09-15 1143 drm_hdcp_update_value(data, DRM_MODE_CONTENT_PROTECTION_ENABLED,
cbc5065be3a652f Sean Paul 2021-09-15 1144 true);
cbc5065be3a652f Sean Paul 2021-09-15 1145 goto out_data_mutex;
cbc5065be3a652f Sean Paul 2021-09-15 1146 }
cbc5065be3a652f Sean Paul 2021-09-15 1147
cbc5065be3a652f Sean Paul 2021-09-15 1148 drm_WARN_ON(dev, data->driver_mutex != NULL);
cbc5065be3a652f Sean Paul 2021-09-15 1149 data->driver_mutex = driver_mutex;
cbc5065be3a652f Sean Paul 2021-09-15 1150
cbc5065be3a652f Sean Paul 2021-09-15 1151 drm_hdcp_helper_driver_lock(data);
cbc5065be3a652f Sean Paul 2021-09-15 1152
cbc5065be3a652f Sean Paul 2021-09-15 1153 if (data->funcs->setup) {
cbc5065be3a652f Sean Paul 2021-09-15 1154 ret = data->funcs->setup(connector, state);
cbc5065be3a652f Sean Paul 2021-09-15 1155 if (ret) {
cbc5065be3a652f Sean Paul 2021-09-15 1156 drm_err(dev, "Failed to setup HDCP %d\n", ret);
cbc5065be3a652f Sean Paul 2021-09-15 1157 goto out;
cbc5065be3a652f Sean Paul 2021-09-15 1158 }
cbc5065be3a652f Sean Paul 2021-09-15 1159 }
cbc5065be3a652f Sean Paul 2021-09-15 1160
cbc5065be3a652f Sean Paul 2021-09-15 1161 if (!data->funcs->are_keys_valid ||
cbc5065be3a652f Sean Paul 2021-09-15 1162 !data->funcs->are_keys_valid(connector)) {
cbc5065be3a652f Sean Paul 2021-09-15 1163 if (data->funcs->load_keys) {
cbc5065be3a652f Sean Paul 2021-09-15 1164 ret = data->funcs->load_keys(connector);
cbc5065be3a652f Sean Paul 2021-09-15 1165 if (ret) {
cbc5065be3a652f Sean Paul 2021-09-15 1166 drm_err(dev, "Failed to load HDCP keys %d\n", ret);
cbc5065be3a652f Sean Paul 2021-09-15 1167 goto out;
cbc5065be3a652f Sean Paul 2021-09-15 1168 }
cbc5065be3a652f Sean Paul 2021-09-15 1169 }
cbc5065be3a652f Sean Paul 2021-09-15 1170 }
cbc5065be3a652f Sean Paul 2021-09-15 1171
cbc5065be3a652f Sean Paul 2021-09-15 1172 /*
cbc5065be3a652f Sean Paul 2021-09-15 1173 * Considering that HDCP2.2 is more secure than HDCP1.4, If the setup
cbc5065be3a652f Sean Paul 2021-09-15 1174 * is capable of HDCP2.2, it is preferred to use HDCP2.2.
cbc5065be3a652f Sean Paul 2021-09-15 1175 */
cbc5065be3a652f Sean Paul 2021-09-15 1176 ret = data->funcs->hdcp2_capable(connector, &capable);
cbc5065be3a652f Sean Paul 2021-09-15 1177 if (ret) {
cbc5065be3a652f Sean Paul 2021-09-15 1178 drm_err(dev, "HDCP 2.x capability check failed %d\n", ret);
cbc5065be3a652f Sean Paul 2021-09-15 1179 goto out;
cbc5065be3a652f Sean Paul 2021-09-15 1180 }
cbc5065be3a652f Sean Paul 2021-09-15 1181 if (capable) {
cbc5065be3a652f Sean Paul 2021-09-15 1182 data->enabled_type = DRM_MODE_HDCP_CONTENT_TYPE1;
cbc5065be3a652f Sean Paul 2021-09-15 1183 ret = data->funcs->hdcp2_enable(connector);
cbc5065be3a652f Sean Paul 2021-09-15 1184 if (!ret) {
cbc5065be3a652f Sean Paul 2021-09-15 1185 check_link_interval = DRM_HDCP2_CHECK_PERIOD_MS;
cbc5065be3a652f Sean Paul 2021-09-15 1186 goto out;
cbc5065be3a652f Sean Paul 2021-09-15 1187 }
cbc5065be3a652f Sean Paul 2021-09-15 1188 }
cbc5065be3a652f Sean Paul 2021-09-15 1189
cbc5065be3a652f Sean Paul 2021-09-15 1190 /*
cbc5065be3a652f Sean Paul 2021-09-15 1191 * When HDCP2.2 fails and Content Type is not Type1, HDCP1.4 will
cbc5065be3a652f Sean Paul 2021-09-15 1192 * be attempted.
cbc5065be3a652f Sean Paul 2021-09-15 1193 */
cbc5065be3a652f Sean Paul 2021-09-15 1194 ret = drm_hdcp_helper_hdcp1_capable(data, &capable);
cbc5065be3a652f Sean Paul 2021-09-15 1195 if (ret) {
cbc5065be3a652f Sean Paul 2021-09-15 1196 drm_err(dev, "HDCP 1.x capability check failed %d\n", ret);
cbc5065be3a652f Sean Paul 2021-09-15 1197 goto out;
cbc5065be3a652f Sean Paul 2021-09-15 1198 }
cbc5065be3a652f Sean Paul 2021-09-15 1199 if (capable && conn_state->content_type != DRM_MODE_HDCP_CONTENT_TYPE1) {
cbc5065be3a652f Sean Paul 2021-09-15 1200 data->enabled_type = DRM_MODE_HDCP_CONTENT_TYPE0;
cbc5065be3a652f Sean Paul 2021-09-15 1201 ret = drm_hdcp_helper_hdcp1_enable(data);
cbc5065be3a652f Sean Paul 2021-09-15 1202 if (!ret)
cbc5065be3a652f Sean Paul 2021-09-15 1203 check_link_interval = DRM_HDCP_CHECK_PERIOD_MS;
cbc5065be3a652f Sean Paul 2021-09-15 1204 }
"ret = 0" and "check_link_interval" is unitialized on else path.
cbc5065be3a652f Sean Paul 2021-09-15 1205
cbc5065be3a652f Sean Paul 2021-09-15 1206 out:
cbc5065be3a652f Sean Paul 2021-09-15 1207 if (!ret) {
cbc5065be3a652f Sean Paul 2021-09-15 @1208 schedule_delayed_work(&data->check_work, check_link_interval);
^^^^^^^^^^^^^^^^^^^
cbc5065be3a652f Sean Paul 2021-09-15 1209 drm_hdcp_update_value(data, DRM_MODE_CONTENT_PROTECTION_ENABLED,
cbc5065be3a652f Sean Paul 2021-09-15 1210 true);
cbc5065be3a652f Sean Paul 2021-09-15 1211 }
cbc5065be3a652f Sean Paul 2021-09-15 1212
cbc5065be3a652f Sean Paul 2021-09-15 1213 drm_hdcp_helper_driver_unlock(data);
cbc5065be3a652f Sean Paul 2021-09-15 1214 if (ret)
cbc5065be3a652f Sean Paul 2021-09-15 1215 data->driver_mutex = NULL;
cbc5065be3a652f Sean Paul 2021-09-15 1216
cbc5065be3a652f Sean Paul 2021-09-15 1217 out_data_mutex:
cbc5065be3a652f Sean Paul 2021-09-15 1218 mutex_unlock(&data->mutex);
cbc5065be3a652f Sean Paul 2021-09-15 1219 return ret;
cbc5065be3a652f Sean Paul 2021-09-15 1220 }
---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all@lists.01.org
_______________________________________________
kbuild mailing list -- kbuild at lists.01.org
To unsubscribe send an email to kbuild-leave at lists.01.org
More information about the Intel-gfx
mailing list