Sunan an-Nasa'i 3188
It was narrated from Mu'adh bin Jabal that the Messenger of Allah (ﷺ) said:
"Campaigns are of two types. As for the one who seek the Face of Allah, obeys the imam, spends what is precious to him, is easy-going with his companion and avoids mischief, when he is asleep and when he is awake, it will all bring reward. But as for the one who fights to show off, and he disobeys the imam and does mischief in the land, he will not come back the same as when he left." [1]

[1] It was not simply be the case that he comes back with no good deeds to his credit, rather he will have a number of evil deeds on his record.
أَخْبَرَنَا عَمْرُو بْنُ عُثْمَانَ، قَالَ حَدَّثَنَا بَقِيَّةُ، عَنْ بَحِيرٍ، عَنْ خَالِدٍ، عَنْ أَبِي بَحْرِيَّةَ، عَنْ مُعَاذِ بْنِ جَبَلٍ، عَنْ رَسُولِ اللَّهِ صلى الله عليه وسلم أَنَّهُ قَالَ ‏
"‏ الْغَزْوُ غَزْوَانِ فَأَمَّا مَنِ ابْتَغَى وَجْهَ اللَّهِ وَأَطَاعَ الإِمَامَ وَأَنْفَقَ الْكَرِيمَةَ وَيَاسَرَ الشَّرِيكَ وَاجْتَنَبَ الْفَسَادَ كَانَ نَوْمُهُ وَنُبْهُهُ أَجْرًا كُلُّهُ وَأَمَّا مَنْ غَزَا رِيَاءً وَسُمْعَةً وَعَصَى الإِمَامَ وَأَفْسَدَ فِي الأَرْضِ فَإِنَّهُ لاَ يَرْجِعُ بِالْكَفَافِ ‏"‏ ‏.‏