It is narrated from Sayyiduna Sa'd (may Allah be pleased with him) that the Messenger of Allah (peace and blessings be upon him) said: "The greatest sin among the Muslims is of the person who asked about something which was not forbidden, but as a result of his question, the ruling of its prohibition was revealed."
Hadith Referenceمسند احمد / مسند باقي العشرة المبشرين بالجنة / 1545