Wells Fargo reported a 17% rise in second-quarter profit on strength in mortgage banking and a drop in expenses.