It seems that David is being criticized here for calling Torah Zemiros. Rashi explains that he called Torah "Zemiros" when he was being hounded by his enemies (and wasn't able to study in depth), yet whatever Torah he learned was still a source of encouragement and joy for him.
Don't we find (Mishnah, end of Menachos) that even if a person is only able to learn a little bit, as long as he does it l'Shem Shamayim he will earn proper reward? Why should David be punished for what he did or said?
H. David Levine, Roanoke, VA. USA
1) Rav Yosef Shalom Elyashiv zt'l, in his Notes on Maseches Sotah, explains that the problem was not the amount, or the depth, of Torah that David learnt when he was fleeing from his enemies, but rather the reason why he learnt Torah at that time of crisis. Rashi writes that when David was on the run, he used the words of Torah "l'Sha'shayni", to "provide me with delight". We can say that this means that David was using the words of Torah as a sort of game to distract his attention from his fear of his enemies. Rashi writes "v'Agur", "I feared them", because he explains the word in the verse "Megurai" to mean fear. David made use of the words of Torah in order to forget his troubles. There is a trace of sin in this attitude because he did not ascribe to the Torah the importance that it deserves.
Possibly in contemporary language we could say that David was utilizing Torah as psychiatric therapy, which lowers the true value of Torah.
2) Rav Yonasan Eibeschitz, zt'l, gives a different explanation in his sefer "Yearos Dvash" Sermon 12 (DH 'to teach the sons of Judah'). He understands the word "Megurai" differently from Rashi, and translates it as "dwelling place". Rav Eibeschitz writes that learning Torah in one's house is not the same as learning it in the Beis Hamidrash. When one learns Torah in the House of Study one should try to sing the Torah with a melody. This creates a pleasant atmosphere for fellow students also. However when one learns at home one should not sing the Torah. This is because if one does so it appears as if one is singing idol-worshippers songs. This is why David said that the Torah became Zemiros specifically in "the house of my dwelling" because it is only there that one should not sing the Torah
3) I think we can see a common factor in the above 2 explanations; that the problem was that David was using the words of Torah either as a distracting game, or as something that sounded like a pagan song, which all takes away from the genuine value of Torah