/* Modify the header if it exceeds.
         */
        if (amdgpu_bad_page_threshold != 0 &&
-           control->ras_num_bad_pages >= ras->bad_page_cnt_threshold) {
+           control->ras_num_bad_pages > ras->bad_page_cnt_threshold) {
                dev_warn(adev->dev,
                        "Saved bad pages %d reaches threshold value %d\n",
                        control->ras_num_bad_pages, ras->bad_page_cnt_threshold);
         */
        if (amdgpu_bad_page_threshold != 0 &&
            control->tbl_hdr.version == RAS_TABLE_VER_V2_1 &&
-           control->ras_num_bad_pages < ras->bad_page_cnt_threshold)
+           control->ras_num_bad_pages <= ras->bad_page_cnt_threshold)
                control->tbl_rai.health_percent = ((ras->bad_page_cnt_threshold -
                                                   control->ras_num_bad_pages) * 100) /
                                                   ras->bad_page_cnt_threshold;
                                res);
                        return -EINVAL;
                }
-               if (ras->bad_page_cnt_threshold > control->ras_num_bad_pages) {
+               if (ras->bad_page_cnt_threshold >= control->ras_num_bad_pages) {
                        /* This means that, the threshold was increased since
                         * the last time the system was booted, and now,
                         * ras->bad_page_cnt_threshold - control->num_recs > 0,