Here how it goes:
After you pass the passport control desk, you will pass the customs desk. The guys at the customs desk will scan the luggage, if they found books or CDs they might ask you to show them. If they do not like them from the cover, they will take the books and/or CDs and give you a slip. The books will be sent to a department where they will check the books/CDs and you can visit them few days later to collect them if allowed, or to be informed that they are confiscated if they weren't allowed. No more or less, no charges or any other things will be taken against you. Sometimes you will have to pay a fine, usually the fine is 500 SAR ($134 USD) per prohibited item, but I guess this only applies to CDs/DVDs and rarely happens. If you are not Saudi most likely they will pass on the fine because you do not know the local rules.
Regarding anti-religious books, they are not allowed. But again, only if they notice and are in the mood to apply the rules. Regarding Da Vinci code, I bought a copy of this book in Saudi Arabia so I guess it is allowed.
In 2000 or 2001, I brought 3 "inappropriate" CDs, the customs checked them and I had to pay 1500 SAR and they were confiscated. I guess I paid because I was stupid and I argued and shouted. Otherwise they would have just taken them and let me go without paying.
Remember, the above is applied to books and CDs/DVDs, alcohol is not allowed and will be confiscated right away. Drugs smuggling is a serious problem and is punishable by the local laws.
Last thing, inside Saudi Arabia, no one will care about the book in your hands :)