Okay, so I see that it returns the \mathbf{A}, \mathbf{B}, \mathbf{C} and \mathbf{D} matrices of the state-space representation. Assuming differentiable functions, these matrices will be always valid, disregard if the point is an equilibrium or not.
If the point is not an equilibrium, the issue arises in correctly simulating the resulting linear system. Because, strictly speaking, it won’t be a linear system, but an affine system. You must correctly handle the offsets everywhere. I’ve wrote the equations for the discrete-time case here. For continuous-time dynamics, it’s something that looks like this, for an ODE system:
You can see that, strangely, there is an \mathbf{f_{op}} offset in the first state-space equation, but not in the second. That’s because:
edit: (also notice that the \mathbf{f_{op}} vanishes from the first state-space equation if the point is an equilibrium.)
TL;DR: please verify that you correctly took into account the operating points when you simulated the resulting linearized system. In the context of a MPC controller, ensure that ALL the operating points/offsets are correctly configured.