@@ -409,10 +409,7 @@ static void __arm_smmu_cmdq_skip_err(struct arm_smmu_device *smmu,
409409 dev_err (smmu -> dev , "\t0x%016llx\n" , (unsigned long long )cmd [i ]);
410410
411411 /* Convert the erroneous command into a CMD_SYNC */
412- if (arm_smmu_cmdq_build_cmd (cmd , & cmd_sync )) {
413- dev_err (smmu -> dev , "failed to convert to CMD_SYNC\n" );
414- return ;
415- }
412+ arm_smmu_cmdq_build_cmd (cmd , & cmd_sync );
416413
417414 queue_write (Q_ENT (q , cons ), cmd , q -> ent_dwords );
418415}
@@ -860,7 +857,7 @@ static int __arm_smmu_cmdq_issue_cmd(struct arm_smmu_device *smmu,
860857{
861858 u64 cmd [CMDQ_ENT_DWORDS ];
862859
863- if (arm_smmu_cmdq_build_cmd (cmd , ent )) {
860+ if (unlikely ( arm_smmu_cmdq_build_cmd (cmd , ent ) )) {
864861 dev_warn (smmu -> dev , "ignoring unknown CMDQ opcode 0x%x\n" ,
865862 ent -> opcode );
866863 return - EINVAL ;
@@ -885,11 +882,20 @@ static void arm_smmu_cmdq_batch_add(struct arm_smmu_device *smmu,
885882 struct arm_smmu_cmdq_batch * cmds ,
886883 struct arm_smmu_cmdq_ent * cmd )
887884{
885+ int index ;
886+
888887 if (cmds -> num == CMDQ_BATCH_ENTRIES ) {
889888 arm_smmu_cmdq_issue_cmdlist (smmu , cmds -> cmds , cmds -> num , false);
890889 cmds -> num = 0 ;
891890 }
892- arm_smmu_cmdq_build_cmd (& cmds -> cmds [cmds -> num * CMDQ_ENT_DWORDS ], cmd );
891+
892+ index = cmds -> num * CMDQ_ENT_DWORDS ;
893+ if (unlikely (arm_smmu_cmdq_build_cmd (& cmds -> cmds [index ], cmd ))) {
894+ dev_warn (smmu -> dev , "ignoring unknown CMDQ opcode 0x%x\n" ,
895+ cmd -> opcode );
896+ return ;
897+ }
898+
893899 cmds -> num ++ ;
894900}
895901
@@ -1764,10 +1770,11 @@ static int arm_smmu_atc_inv_master(struct arm_smmu_master *master)
17641770{
17651771 int i ;
17661772 struct arm_smmu_cmdq_ent cmd ;
1767- struct arm_smmu_cmdq_batch cmds = {} ;
1773+ struct arm_smmu_cmdq_batch cmds ;
17681774
17691775 arm_smmu_atc_inv_to_cmd (0 , 0 , 0 , & cmd );
17701776
1777+ cmds .num = 0 ;
17711778 for (i = 0 ; i < master -> num_streams ; i ++ ) {
17721779 cmd .atc .sid = master -> streams [i ].id ;
17731780 arm_smmu_cmdq_batch_add (master -> smmu , & cmds , & cmd );
0 commit comments