@@ -190,9 +190,10 @@ static int qm_set_regs(struct hisi_qm *qm, struct acc_vf_data *vf_data)
190190 int ret ;
191191
192192 /* Check VF state */
193- if (unlikely (hisi_qm_wait_mb_ready (qm ))) {
193+ ret = hisi_qm_wait_mb_ready (qm );
194+ if (unlikely (ret )) {
194195 dev_err (& qm -> pdev -> dev , "QM device is not ready to write\n" );
195- return - EBUSY ;
196+ return ret ;
196197 }
197198
198199 ret = qm_write_regs (qm , QM_VF_AEQ_INT_MASK , & vf_data -> aeq_int_mask , 1 );
@@ -325,13 +326,15 @@ static void qm_dev_cmd_init(struct hisi_qm *qm)
325326static int vf_qm_cache_wb (struct hisi_qm * qm )
326327{
327328 unsigned int val ;
329+ int ret ;
328330
329331 writel (0x1 , qm -> io_base + QM_CACHE_WB_START );
330- if ( readl_relaxed_poll_timeout (qm -> io_base + QM_CACHE_WB_DONE ,
332+ ret = readl_relaxed_poll_timeout (qm -> io_base + QM_CACHE_WB_DONE ,
331333 val , val & BIT (0 ), MB_POLL_PERIOD_US ,
332- MB_POLL_TIMEOUT_US )) {
334+ MB_POLL_TIMEOUT_US );
335+ if (ret ) {
333336 dev_err (& qm -> pdev -> dev , "vf QM writeback sqc cache fail\n" );
334- return - EINVAL ;
337+ return ret ;
335338 }
336339
337340 return 0 ;
@@ -392,7 +395,7 @@ static int vf_qm_check_match(struct hisi_acc_vf_core_device *hisi_acc_vdev,
392395 ret = vf_qm_version_check (vf_data , dev );
393396 if (ret ) {
394397 dev_err (dev , "failed to match ACC_DEV_MAGIC\n" );
395- return - EINVAL ;
398+ return ret ;
396399 }
397400
398401 if (vf_data -> dev_id != hisi_acc_vdev -> vf_dev -> device ) {
@@ -404,7 +407,7 @@ static int vf_qm_check_match(struct hisi_acc_vf_core_device *hisi_acc_vdev,
404407 ret = qm_get_vft (vf_qm , & vf_qm -> qp_base );
405408 if (ret <= 0 ) {
406409 dev_err (dev , "failed to get vft qp nums\n" );
407- return - EINVAL ;
410+ return ret ;
408411 }
409412
410413 if (ret != vf_data -> qp_num ) {
@@ -501,7 +504,7 @@ static int vf_qm_load_data(struct hisi_acc_vf_core_device *hisi_acc_vdev,
501504 ret = qm_write_regs (qm , QM_VF_STATE , & vf_data -> vf_qm_state , 1 );
502505 if (ret ) {
503506 dev_err (dev , "failed to write QM_VF_STATE\n" );
504- return - EINVAL ;
507+ return ret ;
505508 }
506509 hisi_acc_vdev -> vf_qm_state = vf_data -> vf_qm_state ;
507510
@@ -542,7 +545,7 @@ static int vf_qm_read_data(struct hisi_qm *vf_qm, struct acc_vf_data *vf_data)
542545
543546 ret = qm_get_regs (vf_qm , vf_data );
544547 if (ret )
545- return - EINVAL ;
548+ return ret ;
546549
547550 /* Every reg is 32 bit, the dma address is 64 bit. */
548551 vf_data -> eqe_dma = vf_data -> qm_eqc_dw [QM_XQC_ADDR_HIGH ];
@@ -556,13 +559,13 @@ static int vf_qm_read_data(struct hisi_qm *vf_qm, struct acc_vf_data *vf_data)
556559 ret = qm_get_sqc (vf_qm , & vf_data -> sqc_dma );
557560 if (ret ) {
558561 dev_err (dev , "failed to read SQC addr!\n" );
559- return - EINVAL ;
562+ return ret ;
560563 }
561564
562565 ret = qm_get_cqc (vf_qm , & vf_data -> cqc_dma );
563566 if (ret ) {
564567 dev_err (dev , "failed to read CQC addr!\n" );
565- return - EINVAL ;
568+ return ret ;
566569 }
567570
568571 return 0 ;
@@ -588,7 +591,7 @@ static int vf_qm_state_save(struct hisi_acc_vf_core_device *hisi_acc_vdev,
588591
589592 ret = vf_qm_read_data (vf_qm , vf_data );
590593 if (ret )
591- return - EINVAL ;
594+ return ret ;
592595
593596 migf -> total_length = sizeof (struct acc_vf_data );
594597 /* Save eqc and aeqc interrupt information */
@@ -1379,7 +1382,7 @@ static int hisi_acc_vf_debug_check(struct seq_file *seq, struct vfio_device *vde
13791382 ret = qm_wait_dev_not_ready (vf_qm );
13801383 if (ret ) {
13811384 seq_puts (seq , "VF device not ready!\n" );
1382- return - EBUSY ;
1385+ return ret ;
13831386 }
13841387
13851388 return 0 ;
0 commit comments