@@ -1224,6 +1224,11 @@ static int nfit_test_ctl(struct nvdimm_bus_descriptor *nd_desc,
1224
1224
i = get_dimm (nfit_mem , func );
1225
1225
if (i < 0 )
1226
1226
return i ;
1227
+ if (i >= NUM_DCR ) {
1228
+ dev_WARN_ONCE (& t -> pdev .dev , 1 ,
1229
+ "ND_CMD_CALL only valid for nfit_test0\n" );
1230
+ return - EINVAL ;
1231
+ }
1227
1232
1228
1233
switch (func ) {
1229
1234
case NVDIMM_INTEL_GET_SECURITY_STATE :
@@ -1252,11 +1257,11 @@ static int nfit_test_ctl(struct nvdimm_bus_descriptor *nd_desc,
1252
1257
break ;
1253
1258
case NVDIMM_INTEL_OVERWRITE :
1254
1259
rc = nd_intel_test_cmd_overwrite (t ,
1255
- buf , buf_len , i - t -> dcr_idx );
1260
+ buf , buf_len , i );
1256
1261
break ;
1257
1262
case NVDIMM_INTEL_QUERY_OVERWRITE :
1258
1263
rc = nd_intel_test_cmd_query_overwrite (t ,
1259
- buf , buf_len , i - t -> dcr_idx );
1264
+ buf , buf_len , i );
1260
1265
break ;
1261
1266
case NVDIMM_INTEL_SET_MASTER_PASSPHRASE :
1262
1267
rc = nd_intel_test_cmd_master_set_pass (t ,
@@ -1272,48 +1277,45 @@ static int nfit_test_ctl(struct nvdimm_bus_descriptor *nd_desc,
1272
1277
break ;
1273
1278
case ND_INTEL_FW_GET_INFO :
1274
1279
rc = nd_intel_test_get_fw_info (t , buf ,
1275
- buf_len , i - t -> dcr_idx );
1280
+ buf_len , i );
1276
1281
break ;
1277
1282
case ND_INTEL_FW_START_UPDATE :
1278
1283
rc = nd_intel_test_start_update (t , buf ,
1279
- buf_len , i - t -> dcr_idx );
1284
+ buf_len , i );
1280
1285
break ;
1281
1286
case ND_INTEL_FW_SEND_DATA :
1282
1287
rc = nd_intel_test_send_data (t , buf ,
1283
- buf_len , i - t -> dcr_idx );
1288
+ buf_len , i );
1284
1289
break ;
1285
1290
case ND_INTEL_FW_FINISH_UPDATE :
1286
1291
rc = nd_intel_test_finish_fw (t , buf ,
1287
- buf_len , i - t -> dcr_idx );
1292
+ buf_len , i );
1288
1293
break ;
1289
1294
case ND_INTEL_FW_FINISH_QUERY :
1290
1295
rc = nd_intel_test_finish_query (t , buf ,
1291
- buf_len , i - t -> dcr_idx );
1296
+ buf_len , i );
1292
1297
break ;
1293
1298
case ND_INTEL_SMART :
1294
1299
rc = nfit_test_cmd_smart (buf , buf_len ,
1295
- & t -> smart [i - t -> dcr_idx ]);
1300
+ & t -> smart [i ]);
1296
1301
break ;
1297
1302
case ND_INTEL_SMART_THRESHOLD :
1298
1303
rc = nfit_test_cmd_smart_threshold (buf ,
1299
1304
buf_len ,
1300
- & t -> smart_threshold [i -
1301
- t -> dcr_idx ]);
1305
+ & t -> smart_threshold [i ]);
1302
1306
break ;
1303
1307
case ND_INTEL_SMART_SET_THRESHOLD :
1304
1308
rc = nfit_test_cmd_smart_set_threshold (buf ,
1305
1309
buf_len ,
1306
- & t -> smart_threshold [i -
1307
- t -> dcr_idx ],
1308
- & t -> smart [i - t -> dcr_idx ],
1310
+ & t -> smart_threshold [i ],
1311
+ & t -> smart [i ],
1309
1312
& t -> pdev .dev , t -> dimm_dev [i ]);
1310
1313
break ;
1311
1314
case ND_INTEL_SMART_INJECT :
1312
1315
rc = nfit_test_cmd_smart_inject (buf ,
1313
1316
buf_len ,
1314
- & t -> smart_threshold [i -
1315
- t -> dcr_idx ],
1316
- & t -> smart [i - t -> dcr_idx ],
1317
+ & t -> smart_threshold [i ],
1318
+ & t -> smart [i ],
1317
1319
& t -> pdev .dev , t -> dimm_dev [i ]);
1318
1320
break ;
1319
1321
default :
0 commit comments