  In this paper, we consider the modules for the Heisenberg-Virasoro algebra
and the W algebra $W(2,2)$. We determine the modules whose restriction to the
Cartan subalgebra (modulo center) are free of rank $1$ for the two algebras. We
also determine the simplicity of these modules. These modules provide new
simple modules for the W algebra $W(2,2)$.
