  The method to calculate the non-linearity correction of the electromagnetic
calorimeter response, based on minimisation of the deviation of the measured
neutral meson mass on the energies of it decay photons, is described in this
paper. This method was developed for the electromagnetic calorimeter LGD2 in
the Hyperon-M experiment at U70 accelerator of IHEP. The found correction
allowed to reduce significantly variations of the reconstructed $\pi^0$ and
$\eta$ masses on the minimal energy of the mesons.
