Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

Merge tag 'dmaengine-fix-5.9' of git://git.kernel.org/pub/scm/linux/kernel/git/vkoul/dmaengine

Pull dmaengine fix from Vinod Koul:
"Fix dmatest for misconfigured channel"

* tag 'dmaengine-fix-5.9' of git://git.kernel.org/pub/scm/linux/kernel/git/vkoul/dmaengine:
dmaengine: dmatest: Prevent to run on misconfigured channel

+21 -5
+21 -5
drivers/dma/dmatest.c
··· 129 129 * @nr_channels: number of channels under test 130 130 * @lock: access protection to the fields of this structure 131 131 * @did_init: module has been initialized completely 132 + * @last_error: test has faced configuration issues 132 133 */ 133 134 static struct dmatest_info { 134 135 /* Test parameters */ ··· 138 137 /* Internal state */ 139 138 struct list_head channels; 140 139 unsigned int nr_channels; 140 + int last_error; 141 141 struct mutex lock; 142 142 bool did_init; 143 143 } test_info = { ··· 1186 1184 return ret; 1187 1185 } else if (dmatest_run) { 1188 1186 if (!is_threaded_test_pending(info)) { 1189 - pr_info("No channels configured, continue with any\n"); 1190 - if (!is_threaded_test_run(info)) 1191 - stop_threaded_test(info); 1192 - add_threaded_test(info); 1187 + /* 1188 + * We have nothing to run. This can be due to: 1189 + */ 1190 + ret = info->last_error; 1191 + if (ret) { 1192 + /* 1) Misconfiguration */ 1193 + pr_err("Channel misconfigured, can't continue\n"); 1194 + mutex_unlock(&info->lock); 1195 + return ret; 1196 + } else { 1197 + /* 2) We rely on defaults */ 1198 + pr_info("No channels configured, continue with any\n"); 1199 + if (!is_threaded_test_run(info)) 1200 + stop_threaded_test(info); 1201 + add_threaded_test(info); 1202 + } 1193 1203 } 1194 1204 start_threaded_tests(info); 1195 1205 } else { ··· 1218 1204 struct dmatest_info *info = &test_info; 1219 1205 struct dmatest_chan *dtc; 1220 1206 char chan_reset_val[20]; 1221 - int ret = 0; 1207 + int ret; 1222 1208 1223 1209 mutex_lock(&info->lock); 1224 1210 ret = param_set_copystring(val, kp); ··· 1273 1259 goto add_chan_err; 1274 1260 } 1275 1261 1262 + info->last_error = ret; 1276 1263 mutex_unlock(&info->lock); 1277 1264 1278 1265 return ret; 1279 1266 1280 1267 add_chan_err: 1281 1268 param_set_copystring(chan_reset_val, kp); 1269 + info->last_error = ret; 1282 1270 mutex_unlock(&info->lock); 1283 1271 1284 1272 return ret;