Some of the simplest problems seem to never get fixed. A rattling interior doorknob can keep a door from closing properly. These little things can make your home appear to be cheaply built.
If the lockset is an old-fashioned mortise style with a glass, porcelain or heavy brass doorknob, loosen the setscrew on the side of the knob that secures it to the spindle. Loosen the setscrew far enough for the knob to turn freely without working the latch. Screw the knob clockwise until it is snug but not tight against the door, then tighten the screw. Be sure the screw is tight against a flat side of the spindle.
If the lockset is cylindrical kind, one of the knobs will have a slot on the side of the post, just behind the knob. Push a small screwdriver into the slot to free the knob. Then remove the decorative plate that covers the lockset by pressing a spring clip at the edge. This will show a mounting plate with 2 screws. Just tighten the 2 screws, pop the cover back in place, and push the knob onto the shaft so the keeper snaps back into the slot.