Best practice for handling buffers
In this specific example, yes I would continue to clear the buffers and call your clearBuf() function.

Why? Mainly because you aren't even handling that return status from your I2C tx and rx functions.

What happens if your device suddenly becomes unreachable via I2C and all your Receive calls are failing? I don't know what the HAL_I2C_Master_Receive does to the buffer when timeout duration is reached without looking in depth at their specific implementation but there's a decent chance they just leave the buffer untouched.

The result could be, if not caught via checking return status or other special handling, that you continue to process data as if it is not changing at all.

Real process data will typically be something non-zero so if you're reading a data stream that goes something like [1.56, 1.54, 1.58, 0, 0, 0, 0, 0, 0] a user may be alerted to your device being bad even if you didn't account for handling the specific error condition encountered (such as the one present in your code).

Evaluating this single failure mode of loss of I2C communication for two possible data stream scenarios either:


Your data stream is typically zero and simply doesn't respond to changes due to the failure
Your data stream is typically non-zero and has suddenly zero'd out due to the failure


Clearing your buffers makes the error condition visible in the second scenario even if it doesn't improve things for the first one.

So--you could (and should) fix your error handling to alleviate this particular issue, but what else are you missing? Sensors go bad, I2C operations fail, power can fluctuate, are you making sure you don't lie to your users?