A perturbative study of the scattering matrix of a two-port device chain