Hakim bin Hizam (may Allah be pleased with him) said: I said: O Messenger of Allah! What do you think about the deeds I used to do in the Days of Ignorance with the intention of righteousness, such as charity, freeing slaves or maintaining ties of kinship; is there a reward in them? The Messenger of Allah (peace and blessings be upon him) said: "You have embraced Islam along with the good deeds you did before."
Hadith Referenceالمعجم الكبير للطبراني / باب الحاء / 3076