It is narrated from Sayyiduna Mu'adh bin Jabal (may Allah be pleased with him) that the Messenger of Allah (peace and blessings be upon him) said: "There are five deeds; whoever does even one of them is under the guarantee of Allah: whoever visits a sick person, or goes out with a funeral, or goes out for jihad, or goes to his ruler intending to honour and revere him, or stays in his house in such a way that people are safe from him and he is safe from people."
Hadith Referenceالمعجم الكبير للطبراني / باب الميم / 17191