Documentation was missing for UNNECESSARY_CAST Warning.
Added it to checkpatch.rst with refers from https://lore.kernel.org
Also, pointers been mentioned in Documentation
Suggested-by: Lukas Bulwahn <lukas.bulwahn@gmail.com>
Signed-off-by: Vinesh Raut <redacted>
---
Documentation/dev-tools/checkpatch.rst | 10 ++++++++++
1 file changed, 10 insertions(+)
diff --git a/Documentation/dev-tools/checkpatch.rst b/Documentation/dev-tools/checkpatch.rst
index f0956e9ea2d8..72c2f32b1515 100644
--- a/Documentation/dev-tools/checkpatch.rst
+++ b/Documentation/dev-tools/checkpatch.rst
@@ -268,6 +268,16 @@ Allocation style
See: https://www.kernel.org/doc/html/latest/core-api/memory-allocation.html
+ **UNNECESSARY_CASTS**
+ Any alloc functions should not be cast. Because they usually returns the
+ void pointer, which compiler then implicitly picks the type of pointer at
+ run time. Hence, casting is not prefer on any alloc functions. cast may
+ hide bugs if any exist, as compiler supresses the warnings after casting.
+
+ See:
+ http://c-faq.com/malloc/mallocnocast.html
+ https://lore.kernel.org/lkml/20070808024321.GA6316@redhat.com/
+ https://lore.kernel.org/lkml/a5e60a2b93e10baf84af063f6c8e56402273105d.camel@perches.com/
API usage
-----------
2.30.2
_______________________________________________
Linux-kernel-mentees mailing list
Linux-kernel-mentees@lists.linuxfoundation.org
https://lists.linuxfoundation.org/mailman/listinfo/linux-kernel-mentees