1) Scrape off anything that is loose.
2) Sand to level off rough edges, if possible.
3) Prime with an oil base primer. Something that dries fast.
4) Spread/apply drywall joint compound over the affected areas. Let dry and sand smooth and level with surrounding wall.
5) Reprime fixed areas then paint.
This assumes the walls are smooth without any texture. If textured you will need to retexture the repaired areas before painting.