memcg: fix build warning and avoid checking for mem != null again and again