In chapter 48, David describes his efforts to 'educate' Dora, "to form his little wife's mind". He did that job for months, and he did it carefully, systematically and unsuccessfully - until he started thinking, that a 'childish' mind can be an already formed mind. He admits, that his engage with Dora would never have happened, if his heart had been disciplined. He also admits, that his "secret experience" on the day of their marriage was also due to his undisciplined heart. Discipline seems here something to be avoided rather than pursued, but David offers an alternative: discipline as self-adjustment to the needs of the other:
"I had endeavored to adapt Dora to myself, and found it impracticable. It remained for me to adapt myself to Dora; to share with her what I could, and be happy; to bear on my own shoulders what I must, and be happy still. This was the discipline to which I tried to bring my heart, when I began to think. It made my second year much happier than my first; and, what was better still, made Dora's life all sunshine."
The same kind of self-discipline made him overcome his passion for Agnes, before he knew that she loved him too (see ch. 59 and 60). In this way discipline means the selfless duty to the beloved, despite any differences or conformities.
Chapter 53 seems to confirm this turn, if we accept that David is thinking of the trifles that shadowed the first year of his marriage with Dora. His "undisciplined heart" was the heart that could not estimate life under the aspect of death, which makes every moment invaluable. Discipline, in that sense, is the going away from triviality. In any case, lack of discipline is painfully experienced, only when a beloved person, or the relationship itself, is damaged - it is not something being felt as a danger for the self: