We should be doing i-- on all error paths but we don't if the loop
finishes successfully. I've re-arranged this so that we don't read
beyond the end of acc_flag_to_pipe[] array.
Fixes:
a49d25364dfb ("staging/atomisp: Add support for the Intel IPU v2")
Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
acc_fw->fw,
acc_flag_to_pipe[i].pipe_id,
acc_fw->type);
- if (ret) {
- i--;
+ if (ret)
goto error;
- }
ext_loaded = true;
}
return 0;
error:
- for (; i >= 0; i--) {
+ while (--i >= 0) {
if (acc_fw->flags & acc_flag_to_pipe[i].flag) {
atomisp_css_unload_acc_extension(asd, acc_fw->fw,
acc_flag_to_pipe[i].pipe_id);