9 Mar
2020
9 Mar
'20
2:03 p.m.
On 2020-03-06 22:03, Pierre-Louis Bossart wrote:
- intel_nhlt_free(skl->nhlt); + if (skl->nhlt) + intel_nhlt_free(skl->nhlt);
we could alternatively move the test in intel_nhlt_free, which seems like a more robust thing to do?
Depends. In general kernel-internal API trusts its caller and appending 'ifs' everywhere would unnecessarily slow entire kernel down. While intel_nhlt_free is called rarely, I'd still argue caller should be sane about its invocation.
'if' in skl_probe could be avoided had the function's structure been better. 'if' in skl_remove is just fine, though.
Let's leave it as is.
Czarek