The dispersion relation for the resistive wall modes (RWMs) is derived by using the trial function for the magnetic perturbation proposed in S. W. Haney and J. P. Freidberg, Phys. Fluids B 1, 1637 (1989). The Haney-Freidberg (HF) approach is additionally based on the expansion in d(w)/s << 1, where d(w) is the wall thickness and s is the skin depth. Here, the task is solved without this constraint. The derivation procedure is different too, but the final result is expressed in a similar form with the use of the quantities entering the HF relation. The latter is recovered from our more general relation as an asymptote at d(w) << s, which proves the equivalence of the both approaches in this case. In the opposite limit (d(w) >> s), we obtain the growth rate gamma of the RWMs as a function of gamma(HF) calculated by the HF prescription. It is shown that gamma alpha gamma(2)(HF) and gamma >> gamma(HF) in this range. The proposed relations give gamma for slow and fast RWMs in terms of the integrals calculated by the standard stability codes for toroidal systems with and without a perfectly conducting wall. Also, the links between the considered and existing toroidal and cylindrical models are established with estimates explicitly showing the relevant dependencies. (C) 2014 AIP Publishing LLC.