The Midrash famously comments that Yosef exemplified bitachon, but because he asked the Sar haMashkim to remember him and mention him to Pharoah he had two years of prison time added to his 10 year sentence. The meforshim all are troubled by the contradiction: one the one hand the Midrash praises Yosef as a model of bitachon, on the other hand the same Midrash sees Yosef’s bitachon as flawed because he relied on the Sar haMashkim.
The Yismach Moshe resolves the question with a diyuk. The language of the Midrash picks on the fact that Yosef said to the Sar haMashkim to remember him. Yosef's trust in G-d was never in question, as Yosef knew that his fate was in the hands of hashgacha and foresaw that the Sar haMashkim would ultimately be the agent of his deliverance. Z’chartani… v’hizkartani are the foretelling of events, not mere requests. Yosef’s only error was in relating this information to the Sar haMashkim instead of keeping it to himself.
What is a bit unclear from the Yismach Moshe is why Yosef should be criticized for revealing G-d’s ultimate plan. Perhaps the answer is related to the Rambam’s principle (see here) that nevuah which is spoken is guaranteed to come true while that which is given to the Navi as foreknowledge can be changed. By articulating G-d’s plan to the Sar haMashkim, Yosef in effect guaranteed its fulfillment. Paradoxically, and perhaps this is the meaning of the Midrash, being sure enough to tell others what would happen diminished the need for bitachon in the long run.