How to prep a peeling wall for paint
As we always advise, the secret to a good paint job is proper preparation. It can be a pain, but you must remove all loose and peeling paint, wash the surface and Spackle holes and cracks before priming and painting. Often a light sanding is a good idea, especially on any glossy finishes. Be aware of lead hazards on any paint applied before 1978.  The actual application of paint is the easy part, don't rush the prep, it is the most important part.