mirror of
https://github.com/torvalds/linux.git
synced 2024-12-26 04:42:12 +00:00
lib: crc8: pointer to data block should be const
crc8() does not change the data passed to it, so the pointer argument should be declared const. This avoids callers that receive const data having to cast it to a non-const pointer to call crc8(). Link: https://lkml.kernel.org/r/20210329122409.3291-1-rf@opensource.cirrus.com Signed-off-by: Richard Fitzgerald <rf@opensource.cirrus.com> Acked-by: Randy Dunlap <rdunlap@infradead.org> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
This commit is contained in:
parent
ade29d4fdb
commit
e18baa7cc3
@ -96,6 +96,6 @@ void crc8_populate_msb(u8 table[CRC8_TABLE_SIZE], u8 polynomial);
|
||||
* Williams, Ross N., ross<at>ross.net
|
||||
* (see URL http://www.ross.net/crc/download/crc_v3.txt).
|
||||
*/
|
||||
u8 crc8(const u8 table[CRC8_TABLE_SIZE], u8 *pdata, size_t nbytes, u8 crc);
|
||||
u8 crc8(const u8 table[CRC8_TABLE_SIZE], const u8 *pdata, size_t nbytes, u8 crc);
|
||||
|
||||
#endif /* __CRC8_H_ */
|
||||
|
@ -71,7 +71,7 @@ EXPORT_SYMBOL(crc8_populate_lsb);
|
||||
* @nbytes: number of bytes in data buffer.
|
||||
* @crc: previous returned crc8 value.
|
||||
*/
|
||||
u8 crc8(const u8 table[CRC8_TABLE_SIZE], u8 *pdata, size_t nbytes, u8 crc)
|
||||
u8 crc8(const u8 table[CRC8_TABLE_SIZE], const u8 *pdata, size_t nbytes, u8 crc)
|
||||
{
|
||||
/* loop over the buffer data */
|
||||
while (nbytes-- > 0)
|
||||
|
Loading…
Reference in New Issue
Block a user