

The DaVinci code sold 80 millions copies. The first HP book alone sold 120 millions, and the whole series 600 millions, being the most sold series of books.
Not only they are one order of magnitude apart, but I think they sold for different reasons.
I haven’t read Dan Brown’s stuff, but I also doubt it’s terribly written by the way. Books that capture the interest of a population more and more unused to read can be shallow, banal, inconsistent, whatever, but not terribly written. Casual readers can hardly finish a terribly written book. In any case, HP books are children’s books. Children or teenagers are not literary critics, it’s not about reading “great literature”, however you define that.
I also can’t help to notice the coincidence that all the HP critiques started appearing in the last years, when the author went bananas. A series this popular, which ended in 2007, and suddenly 15 years later people notice that it’s “terribly written”? This smells more to me of a damnatio memoriae than genuine critique.
I actually disagree that a book is “problematic” because it touches, presents, includes etc. any topic that morally we disagree with. Not every book has to be a manifesto or a depiction for a moral and just society, which is why I find most of the arguments against HP to be weak (some points were listed in a sibling comment thread).
I am quite sure this is true for any book (especially fiction), in fact. Which is why I think it’s an activity that makes sense only to justify the pre-existing opinion about the book, rather than having a value in itself.
To be clear, I know that Dan Brown stuff is garbage. I just have seen people who I think never read a book in the previous 10 years read that one (in translation though, so who knows…). So the book must at least be interesting and intriguing to keep the attention of people who are not used to read. For me this means not fitting in the “terrible writing” category, but maybe we mean different things by that.