Allaah (The Most High) stated about the one who was not benefited by the abundant knowledge that was given to him:
[وَلَوۡ شِئۡنَا لَرَفَعۡنَـٰهُ بِہَا- And had We willed, We would surely have elevated him therewith (7:176)]
Imaam Ibnul Qayyim (rahimahullaah) said: Therefore, Allaah informed (us) that being elevated in His presence is not merely acquired through knowledge, for indeed this person was from the scholars; rather elevation is acquired through adherence to the truth, giving precedence to it and aiming to please Allaah. Indeed, this person was among the most knowledgeable during his era, but he was neither elevated through his knowledge nor did he benefit from it. We seek Allaah’s protection from knowledge that does not benefit.
[Source: بدائع التفسير الجامع لما فسَّره الإمام ابن القيم الجوزية Vol 1. Page: 427-429]