We present here a new approach of the partial control method, which is a useful control technique applied to transient chaotic dynamics affected by a bounded noise. Usually we want to avoid the escape of these chaotic transients outside a certain region $Q$ of the phase space. For that purpose, there exists a control bound such that for controls smaller than this bound trajectories are kept in a special subset of $Q$ called the safe set. The aim of this new approach is to go further, and to compute for every point of $Q$ the minimal control bound that would keep it in $Q$. This defines a special function that we call the safety function, which can provide the necessary information to compute the safe set once we choose a particular value of the control bound. This offers a generalized method where previous known cases are included, and its use encompasses more diverse scenarios.