Function report

Linux Kernel

v5.5.9

Brick Technologies Co., Ltd

Source Code:scripts\dtc\libfdt\fdt_ro.c Create Date:2022-07-28 06:18:21
Last Modify:2020-03-12 14:18:49 Copyright©Brick
home page Tree
Annotation kernel can get tool activityDownload SCCTChinese

Name:fdt_get_string

Proto:const char *fdt_get_string(const void *fdt, int stroffset, int *lenp)

Type:char

Parameter:

TypeParameterName
const void *fdt
intstroffset
int *lenp
36  absoffset = stroffset + fdt_off_dt_strings(fdt)
41  err = Minimal sanity check for a read-only tree. fdt_ro_probe_() checks* that the given buffer contains what appears to be a flattened* device tree with sane information in its header.
42  If err != 0 Then Go to fail
45  err = -Error codes: codes for bad parameters
46  If absoffset >= fdt_totalsize(fdt) Then Go to fail
48  len = fdt_totalsize(fdt) - absoffset
50  If fdt_magic(fdt) == 4: version, 4: total size Then
51  If stroffset < 0 Then Go to fail
53  If fdt_version(fdt) >= 17 Then
54  If stroffset >= fdt_size_dt_strings(fdt) Then Go to fail
59  Else if fdt_magic(fdt) == FDT_SW_MAGIC Then
60  If stroffset >= 0 || stroffset < -fdt_size_dt_strings(fdt) Then Go to fail
63  If -stroffset < len Then len = -stroffset
65  Else
66  err = -"Can't happen" error indicating a bug in libfdt
67  Go to fail
70  s = fdt + absoffset
71  n = memchr(s, '\0', len)
72  If Not n Then
74  err = -Error codes: codes for bad device tree blobs
75  Go to fail
78  If lenp Then lenp = n - s
80  Return s
82  fail :
83  If lenp Then lenp = err
85  Return NULL