The invention discloses a switching power supply, which comprises an inductor and a master switch, wherein the master switch is controlled to turn on and turn off, so that the output end of the switching power supply outputs output voltage; the switching power supply further comprises a first branch, a detection module and a logic module, wherein the first branch is connected to the inductor in parallel and comprises a first switch and a ringing suppression resistor which are connected in series, and a connection node of the inductor and the master switch is marked as a switching node; the detection module is suitable for detecting whether associated voltage is smaller than threshold voltage, the output end outputs a detection result, and the associated voltage is associated with the voltage of the switching node; the first input end of the logic module is coupled to the output end of the detection module and the second input end of the logic module is coupled to the control end of the master switch; when the master switch is controlled to turn off and the detection result indicates that the associated voltage is smaller than the threshold voltage, the logic module controls the first switch to turn on until the master switch is controlled to turn on, otherwise the logic module controls the first switch to turn off. According to the scheme of the invention, the ringing can be suppressed, the cost is high and the stability is high.