@@ -7283,6 +7283,9 @@ static int get_pi_info(struct nvme_transport_handle *hdl,
72837283 lbs = 1 << ns -> lbaf [lba_index ].ds ;
72847284 ms = le16_to_cpu (ns -> lbaf [lba_index ].ms );
72857285
7286+ * logical_block_size = lbs ;
7287+ * metadata_size = ms ;
7288+
72867289 nvm_ns = nvme_alloc (sizeof (* nvm_ns ));
72877290 if (!nvm_ns )
72887291 return - ENOMEM ;
@@ -7301,15 +7304,12 @@ static int get_pi_info(struct nvme_transport_handle *hdl,
73017304 * 5.2.2.2 Protection Information and Read Commands
73027305 */
73037306 if (!((prinfo & 0x8 ) != 0 && ms == pi_size ))
7304- logical_block_size += ms ;
7307+ * logical_block_size += ms ;
73057308 }
73067309
73077310 if (invalid_tags (lbst , ilbrt , sts , pif ))
73087311 return - EINVAL ;
73097312
7310- * logical_block_size = lbs ;
7311- * metadata_size = ms ;
7312-
73137313 return 0 ;
73147314}
73157315
@@ -8221,7 +8221,7 @@ static int submit_io(int opcode, char *command, const char *desc, int argc, char
82218221 void * buffer ;
82228222 int err = 0 ;
82238223 int flags ;
8224- __u16 ms ;
8224+ __u16 ms = 0 ;
82258225
82268226 const char * start_block_addr = "64-bit addr of first block to access" ;
82278227 const char * block_size = "if specified, logical block size in bytes;\n"
@@ -8400,8 +8400,10 @@ static int submit_io(int opcode, char *command, const char *desc, int argc, char
84008400 err = get_pi_info (hdl , cfg .nsid , cfg .prinfo ,
84018401 cfg .ilbrt , cfg .lbst , & logical_block_size , & ms );
84028402 if (err ) {
8403- logical_block_size = 0 ;
8404- ms = 0 ;
8403+ if (err != - ENAVAIL ) {
8404+ logical_block_size = 0 ;
8405+ ms = 0 ;
8406+ }
84058407 pi_available = false;
84068408 } else {
84078409 pi_available = true;
0 commit comments