A man caught with a stash of illegal drugs stored in McDonald's bags in his bedroom has kept his freedom.