It is narrated from Sayyiduna Abdullah bin Abbas (may Allah be pleased with them both) that the Messenger of Allah (peace and blessings be upon him) said: "I marvel at the patience and nobility of my brother Yusuf (peace be upon him), may Allah forgive him. When (a messenger) was sent to him to ask about the dream (he gave its interpretation); had it been me, I would not have done so until I had come out (of prison). And I marvel at his patience and nobility, may Allah forgive him: he was called (to be released), yet he did not come out until he had made his excuse known (the investigation of his innocence); had it been me, I would have hurried to the door. And had it not been for that word (spoken to the king's companion), he would not have stayed so long in prison, because he sought relief from someone other than Allah, his saying: Mention me before your master [Surah Yusuf: 42]."
Hadith Referenceالمعجم الكبير للطبراني / باب العين / 11590