We derive in this paper a unified framework for a priori and a posteriori error analysis of mixed finite element discretizations of second-order elliptic problems. It is based on the classical primal weak formulation, the postprocessing of the potential proposed in [T. Arbogast and Z. Chen, On the implementation of mixed methods as nonconforming methods for second-order elliptic problems, Math. Comp. 64 (1995), 943