Hadith
حَدَّثَنَا هِشَامُ بْنُ عَمَّارٍ، حَدَّثَنَا صَدَقَةُ بْنُ خَالِدٍ، حَدَّثَنَا عُثْمَانُ بْنُ أَبِي الْعَاتِكَةِ الأَزْدِيُّ، عَنْ عُمَيْرِ بْنِ هَانِئٍ الْعَنْسِيِّ، عَنْ أَبِي هُرَيْرَةَ، قَالَ قَالَ رَسُولُ اللَّهِ صلى الله عليه وسلم " مَنْ أَتَى الْمَسْجِدَ لِشَىْءٍ فَهُوَ حَظُّهُ " .
Abu Hurairah reported the Messenger of Allah (May peace be upon him) as saying; one shall have the thing the for which one comes to the mosque
Hasan · Al-Albani
Sunan Abi Dawud 472 ·Book 2, Hadith 82·Also available on sunnah.com·