eeprom.c
Assigns a negative errno constantCopies bytes with native memcpy
SHA-256ad4051663be022a018a6c3148fcba1c9a5e8806c39a0c085aed0b4e2dcff30d0
MaleculeO(Er)H(Db₂)
Evidence
1// SPDX-License-Identifier: BSD-3-Clause-Clear
2/*
3 * Copyright (C) 2016 Felix Fietkau <nbd@nbd.name>
4 */
5#include <linux/of.h>
6#include <linux/of_net.h>
7#include <linux/mtd/mtd.h>
8#include <linux/mtd/partitions.h>
9#include <linux/nvmem-consumer.h>
10#include <linux/etherdevice.h>
11#include "mt76.h"
12
13static int mt76_get_of_eeprom_data(struct mt76_dev *dev, void *eep, int len)
14{
15 struct devic …
19:11… _get_property(np, "mediatek,eeprom-data", &size);
20 if (!data)
21 return -ENOENT;
22
23 if (size > len)
24 return -EINVAL;
25
26 memcpy(eep, data, size);
27
28 return 0;
⋯5 lines
61:15… RR(mtd);
62 goto out_put_node;
63 }
64
65 if (size <= sizeof(*list)) {
66 ret = -EINVAL;
67 goto out_put_node;
68 }
⋯4 lines
359:13… _dev *dev = phy->dev;
360 struct device_node *np;
361 const s8 *val;
362 char name[16];
363 u32 mcs_rates = dev->drv->mcs_rates;
364 u32 ru_rates = ARRAY_SIZE(dest->ru[0]);
365 char band;
366 size_t len;
367 s8 max_power = 0;