He heard the Messenger of Allah ﷺ say, "When a judge issues a ruling and exercises his judgment and gets it right, he receives two rewards. When he issues a ruling and exercises his judgment and gets it wrong, he receives one reward."Yazid said, "I narrated this to Abu Bakr bin Amr bin Hazm, and he said, 'This is exactly how Abu Salama narrated it to me from Abu Hurairah.'"
حدثنا هشام بن عمار حدثنا عبد العزيز بن محمد الدراوردي حدثنا يزيد بن عبد الله بن الهاد عن محمد بن إبراهيم التيمي عن بسر بن سعيد عن أبي قيس مولى عمرو بن العاص
أنه سمع رسول الله ﷺ يقول إذا حكم الحاكم فاجتهد فأصاب فله أجران وإذا حكم فاجتهد فأخطأ فله أجر قال يزيد فحدثت به أبا بكر بن عمرو بن حزم فقال هكذا حدثنيه أبو سلمة عن أبي هريرة
Bukhari narrated it in "Holding Fast to the Book and the Sunnah," in the chapter on the reward of the judge when he exercises independent judgment and gets it right or wrong, hadith no. 7352, from the hadith of Ibn Hadi, with this wording. Muslim narrated it in "Judgments," in the chapter explaining the reward of the judge when he exercises independent judgment and gets it right or wrong, hadith no. 1716, from the hadith of Darawardi, with this wording.