  Let $\mathfrak{a}$ be an ideal of a commutative noetherian ring $R$ and $M,
N$ two finitely generated $R$-modules. By using a spectral sequence argument,
it is shown that if either $\mathrm{dim}_RM\leq2$ and
$\mathrm{H}^{i}_\mathfrak{a}(N)$ are $\mathfrak{a}$-cofinite for all $i\geq0$,
or $\mathrm{H}^{i}_\mathfrak{a}(N)$ is an $\mathfrak{a}$-cofinite module of
dimension $\leq1$ for each $i\geq1$, or $q(\mathfrak{a},R)\leq1$, then the
$R$-modules $\mathrm{H}^{t}_\mathfrak{a}(M,N)$ are $\mathfrak{a}$-cofinite for
all $t\geq0$.
