COMMENTARY on 12:22
A. Yusuf Ali:

Translation:
When Joseph attained 1664 His full manhood, We gave him power and knowledge: thus do We reward those who do right. 1665
Commentary:

1664  When Joseph left Canaan , he was a young and immature lad of seventeen or eighteen, but his nature was innocent and good. Through the vicissitudes of his fortune in Egypt , he grew in knowledge, judgement, and power.

1665  Muhsinin: those who do right, those who do good. Both ideas are implied. In following the right conduct, you are necessarily doing good to yourself and to others.