On a generalized Egnell inequality