]> git.ipfire.org Git - thirdparty/u-boot.git/blame - lib/tables_csum.c
net: hifemac_mdio: use log_msg_ret() correctly, report error by dev_err()
[thirdparty/u-boot.git] / lib / tables_csum.c
CommitLineData
83d290c5 1// SPDX-License-Identifier: GPL-2.0+
1befb38b
AG
2/*
3 * Copyright (C) 2015, Bin Meng <bmeng.cn@gmail.com>
1befb38b
AG
4 */
5
467382ca 6#include <linux/types.h>
1befb38b 7
e3db8d60 8u8 table_compute_checksum(const void *v, const int len)
1befb38b 9{
e3db8d60 10 const u8 *bytes = v;
1befb38b
AG
11 u8 checksum = 0;
12 int i;
13
14 for (i = 0; i < len; i++)
15 checksum -= bytes[i];
16
17 return checksum;
18}