Depending on the CS_FL_EOS status, we either set CS_FL_ERR_PENDING or CS_FL_ERROR at various places. Let's have a generic function to do this.