  In this paper, we completely determine the number of solutions to $
\operatorname{Tr}^{q^2}_q(bx+b)+c=0, x\in \mu_{q+1}\backslash \{-1\}$ for all
$b\in \mathbb{F}_{q^2}, c\in\mathbb{F}_{q}$. As an application, we can give the
weight distributions of a class of linear codes, and give a completely answer
to a recent conjecture about a class of NMDS codes proposed by Heng.
