Clocking the bus nine times and then issuing STOP, after you have checked whether SDA or SCL is the line that is held low, is the right recovery backbone. I would not treat nine pulses as a universal cure: a slave that is stretching SCL, a second master, or a line held low by a short, will not be released by more clocks. Three checks still decide whether you can bring the bus back without a board-level power cycle.
The first is to recover the wires and then re-initialize the device. A slave that reset mid-byte may release SDA after the clocks and still have a half-written register, an enabled output, or a different I²C address bit. Bus recovery only returns the lines to idle; the driver must run the device’s init sequence again, or the next transaction will hang for a different reason. If SCL is stuck, pull the slave reset (or a per-rail load switch) and only then retry the clocks. A ten-bit address or a transaction that was in a block read may need more than nine clocks; follow the controller’s recovery chapter rather than a fixed count.
The second is why the slave reset in the first place. Mid-transaction resets are often a brown-out on the slave rail, a watchdog, or an ESD hit, not a random I²C bug. If you only un-stick the bus, the same hang will come back. Measure the slave supply and its reset pin at the moment the hang is logged, and fix the rail or the reset timing so a transaction is not left open across a reset. Pull-ups must still be sized for the bus capacitance and the required rise time; a too-strong pull-up can keep a weak slave from releasing the line, a too-weak one looks like a hang at higher clock rates.
The third is how the host does this on Linux. Many adapters expose i2c_recover_bus or a GPIO bit-bang recovery; call that from the timeout path, then re-probe or re-init the client, rather than resetting the whole SoC. Isolate a defective slave with a mux or a load switch so the rest of the bus stays up. Stamp the hang, the recovery clocks, and the re-init with CLOCK_MONOTONIC so you can tell a one-shot glitch from a rail that is still collapsing. Acceptance is: inject a mid-transaction slave reset, confirm the bus returns to idle without a board power cycle, and confirm the device is re-initialized before traffic resumes.