Thermodynamic approach to the equation of state of a magnetized Fermi gas