summaryrefslogtreecommitdiffstats
path: root/scripts/checkpatch.pl
Commit message (Collapse)AuthorAgeFilesLines
* checkpatch: require quotes around section name in the __section() macroMarek BehĂșn2021-05-241-1/+1
| | | | | | | This is how Linux does this now, see Linux commit 339f29d91acf. Signed-off-by: Marek BehĂșn <marek.behun@nic.cz> Reviewed-by: Simon Glass <sjg@chromium.org>
* patman: Parse checkpatch by message instead of by lineEvan Benn2021-04-291-8/+10
| | | | | | | | | | | | Parse each empty-line-delimited message separately. This saves having to deal with all the different line content styles, we only care about the header ERROR | WARNING | NOTE... Also make checkpatch print line information for a uboot specific warning. Signed-off-by: Evan Benn <evanbenn@chromium.org> Reviewed-by: Simon Glass <sjg@chromium.org>
* checkpatch: Add warnings for using strn(cat|cpy)Sean Anderson2021-04-121-0/+6
| | | | | | | | | | | | | | | | | | | | | | strn(cat|cpy) has a bad habit of not nul-terminating the destination, resulting in constructions like strncpy(foo, bar, sizeof(foo) - 1); foo[sizeof(foo) - 1] = '\0'; However, it is very easy to forget about this behavior and accidentally leave a string unterminated. This has shown up in some recent coverity scans [1, 2] (including code recently touched by yours truly). Fortunately, the guys at OpenBSD came up with strl(cat|cpy), which always nul-terminate strings. These functions are already in U-Boot, so we should encourage new code to use them instead of strn(cat|cpy). [1] https://lists.denx.de/pipermail/u-boot/2021-March/442888.html [2] https://lists.denx.de/pipermail/u-boot/2021-January/438073.html Signed-off-by: Sean Anderson <seanga2@gmail.com> Reviewed-by: Simon Glass <sjg@chromium.org>
* cmd: fdt: skip board specific fixup using env variableWasim Khan2021-02-241-0/+6
| | | | | | | | | | Sometimes it is useful to boot OS with already fixed-up device tree. Check for env variable 'skip_board_fixup' before calling ft_board_setup(). Current behaviour is unchanged, additionally user can set skip_board_fixup to 1 to skip the fixup. Signed-off-by: Wasim Khan <wasim.khan@nxp.com>
* checkpatch: Add warnings for unexpected struct namesSimon Glass2020-12-131-0/+38
| | | | | | | As a way of keeping the driver declarations more consistent, add a warning if the struct used does not end with _priv or _plat. Signed-off-by: Simon Glass <sjg@chromium.org>
* checkpatch.pl: Make CONFIG_IS_ENABLED(CONFIG_*) an errorAlper Nebi Yasak2020-10-141-0/+6
| | | | | | | | | | CONFIG_IS_ENABLED() takes the kconfig name without the CONFIG_ prefix, e.g. CONFIG_IS_ENABLED(CLK) for CONFIG_CLK. Make including the prefix an error in checkpatch.pl so calls in the wrong format aren't accidentally reintroduced. Signed-off-by: Alper Nebi Yasak <alpernebiyasak@gmail.com> Reviewed-by: Simon Glass <sjg@chromium.org>
* checkpatch.pl: Make fdt / initrd relocation disabling an errorTom Rini2020-08-271-0/+6
| | | | | | | | Entirely disabling relocation of the device tree or initrd is almost never the right answer. Doing this by default leads to hard to diagnose run-time failures. Signed-off-by: Tom Rini <trini@konsulko.com>
* checkpatch: Don't allow common.h and dm.h in headersSimon Glass2020-08-031-2/+8
| | | | | | | These headers should not be included in other header files. Add a checkpatch rule and test for this. Signed-off-by: Simon Glass <sjg@chromium.org>
* checkpatch: Don't warn about PREFER_IF in headers/DT filesSimon Glass2020-07-091-1/+1
| | | | | | | This warning should only be displayed for C files. Fix it and update the test. Signed-off-by: Simon Glass <sjg@chromium.org>
* checkpatch.pl: Fully re-sync with v5.7Tom Rini2020-07-011-106/+302
| | | | | | | | | | While commit 048a648298b1 ("checkpatch.pl: Update to v5.7") largely re-syncs us with checkpatch.pl from v5.7 there are a number of things missing still. Re-copy the script and again take care to keep our allowed debug prints and now localized checks intact. Fixes: 048a648298b1 ("checkpatch.pl: Update to v5.7") Signed-off-by: Tom Rini <trini@konsulko.com>
* checkpatch.pl: Add check for defining CONFIG_CMD_xxx via config filesTom Rini2020-06-041-0/+6
| | | | | | | All of our cmds have a Kconfig entry. Making enabling a CMD via the config file an error to checkpatch.pl. Signed-off-by: Tom Rini <trini@konsulko.com>
* checkpatch.pl: Request if() instead #ifdefSimon Glass2020-06-041-0/+6
| | | | | | | There is a lot of use of #ifdefs in U-Boot. In an effort reduce this, suggest using the compile-time construct. Signed-off-by: Simon Glass <sjg@chromium.org>
* checkpatch.pl: Request a test when a new command is addedSimon Glass2020-06-041-0/+6
| | | | | | | This request is made with nearly every new command. Point to some docs on how to do it. Signed-off-by: Simon Glass <sjg@chromium.org>
* checkpatch.pl: Warn if the flattree API is usedSimon Glass2020-06-041-0/+6
| | | | | | We want people to use the livetree API, so request it. Signed-off-by: Simon Glass <sjg@chromium.org>
* checkpatch.pl: Add a check for tests needed for uclassesSimon Glass2020-06-041-0/+6
| | | | | | | | | | A common problem when submitting a new uclass is to forget to add sandbox tests. Add a warning for this. Of course tests should always be added for new code, but this one seems to be missed by nearly every new contributor. Signed-off-by: Simon Glass <sjg@chromium.org>
* checkpatch.pl: Add a U-Boot optionSimon Glass2020-06-041-0/+12
| | | | | | | Add an option to indicate that U-Boot-specific checks should be enabled. Add a function to house the code that will be added. Signed-off-by: Simon Glass <sjg@chromium.org>
* checkpatch.pl: Update to v5.7Simon Glass2020-06-041-165/+63
| | | | | | | | | Keep the U-Boot changes to $logFunctions Signed-off-by: Simon Glass <sjg@chromium.org> [trini: Resync with v5.7 release which changed the default max line length, update commit to reflect] Signed-off-by: Tom Rini <trini@konsulko.com>
* tools: checkpatch: Restore 'debug' and 'printf' to logFunctions listJames Byrne2019-11-231-0/+2
| | | | | | | | | | | | | | | | The 'debug' and 'printf' functions were previously added to the list of logFunctions in commit 0cab42110dbf ("checkpatch.pl: Add 'debug' to the list of logFunctions") and commit 397bfd4642c1 ("checkpatch.pl: Add 'printf' to logFunctions") but these additions were lost when newer versions of checkpatch were pulled in from the upstream Linux kernel version. This restores them so that you don't end up in a situation where checkpatch will give a warning for "quoted string split across lines" which you cannot fix without getting a warning for "line over 80 characters" instead. Signed-off-by: James Byrne <james.byrne@origamienergy.com>
* checkpatch.pl: update from Linux kernel v5.4-rc3Heinrich Schuchardt2019-10-311-113/+333
| | | | | | | | Update from upstream. Just minor changes like checking that the author has also done a sign-off. Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
* checkpatch.pl: update from Linux kernel v4.16Heinrich Schuchardt2018-04-101-190/+300
| | | | | | | | | | | | Update scripts/checkpatch.pl from upstream. One of the many corrections is not creating an error for cover-letters. Reintroduce U-Boot's 5c761ce58666b3a1695697498598f8bf3484a0c7 checkpatch.pl: Add warning for new __packed additions Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
* checkpatch: Support wide stringsHeinrich Schuchardt2017-10-291-3/+4
| | | | | | | | | | Allow prefixing typical strings with L for wide strings Patch originally by Joe Perches https://lkml.org/lkml/2017/10/17/1117 Signed-off-by: Joe Perches <joe@perches.com> Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
* checkpatch.pl: Add warning for new __packed additionsHeinrich Schuchardt2017-09-151-0/+7
| | | | | | | | | | While there are valid reasons to use __packed, often the answer is that you should be doing something else here instead. This reintroduces the changes of f503cc49a570 (Add warning for new __packed additions) Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
* checkpatch: update from Linux v4.13-rc6Heinrich Schuchardt2017-09-141-422/+2222
| | | | | | | | | | | | | | | | | | | | | Checkpatch produces the following warning: Unescaped left brace in regex is deprecated here (and will be fatal in Perl 5.30), passed through in regex; marked by <-- HERE in m/^(\+.*(?:do|\))){ <-- HERE / at scripts/checkpatch.pl line 3348. The curent checkpatch of the Linux kernel corrects this bug and many others. It provides improved colored output. So replace checkpatch by the current Linux version. Add an empty file scripts/const_structs.checkpatch. We can later fill it according to our needs. Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
* checkpatch: Port spelling to checkpatchDan Murphy2017-02-081-0/+81
| | | | | | | | | | | | | | | Pick commit 66b47b4a9dad0 checkpatch: look for common misspellings from the Linux kernel for spelling check from Kees Cook In addition pulled in additional changes commit ebfd7d6237531 checkpatch: add optional --codespell dictionary to find more typos from the Linux kernel for codespell from Joe Perches commit f1a63678554f8 checkpatch: remove local from codespell path from the Linux kernel for dictionary path from Maxim Uvarov Signed-off-by: Dan Murphy <dmurphy@ti.com> Reviewed-by: Tom Rini <trini@konsulko.com>
* Various, accumulated typos collected from around the tree.Robert P. J. Day2016-10-061-2/+2
| | | | | | | | | | | | | | | | | | | | | Fix various misspellings of: * deprecated * partition * preceding,preceded * preparation * its versus it's * export * existing * scenario * redundant * remaining * value * architecture Signed-off-by: Robert P. J. Day <rpjday@crashcourse.ca> Reviewed-by: Jagan Teki <jteki@openedev.com> Reviewed-by: Stefan Roese <sr@denx.de>
* checkpatch: fix left brace warningHeiko Schocher2016-01-041-5/+5
| | | | | | | | | | | | | | | | | | | | | | using checkpatch with Perl 5.22.0 generates a warning, this is fixed in linux through commit: commit 4e5d56bdf892e18832a6540b63ebf709966bce2a Author: Eddie Kovsky <ewk@edkovsky.org> Date: Wed Sep 9 15:37:52 2015 -0700 checkpatch: fix left brace warning Using checkpatch.pl with Perl 5.22.0 generates the following warning: Unescaped left brace in regex is deprecated, passed through in regex; This patch fixes the warnings by escaping occurrences of the left brace inside the regular expression. Adapt it for U-Boot. Signed-off-by: Heiko Schocher <hs@denx.de>
* checkpatch: remove unnecessary + after {8,8}Joe Perches2014-09-251-1/+1
| | | | | | | | | | | | | | | Pick the following commit from Linux kernel: commit 66cb4ee0e52ca721f609fd5eec16187189ae5fda Author: Joe Perches <joe@perches.com> Date: Wed Sep 10 09:40:47 2014 +1000 checkpatch: remove unnecessary + after {8,8} There's a useless "+" use that needs to be removed as perl 5.20 emits a "Useless use of greediness modifier '+'" message each time it's hit. Signed-off-by: Marek Vasut <marex@denx.de> Cc: Tom Rini <trini@ti.com>
* scripts: update checkpatch.pl to latest upstream versionTom Rini2014-03-041-208/+1067
| | | | | | | | | | Update to v3.14-rc4's version of checkpatch.pl. In doing so we drop the changes to top_of_kernel_tree() as we pass in --no-tree and drop our changes about MAINTAINERS as that's for reporting checkpatch.pl problems itself (and upstream has said they'll reword this section to be clearer). Signed-off-by: Tom Rini <trini@ti.com>
* checkpatch.pl: Add warning for new __packed additionsTom Rini2014-02-261-0/+5
| | | | | | | While there are valid reasons to use __packed, often the answer is that you should be doing something else here instead. Signed-off-by: Tom Rini <trini@ti.com>
* Makefile: Move some scripts imported from LinuxMasahiro Yamada2013-12-131-0/+3709
We have some scripts imported from Linux Kernel: setlocalversion, checkstack.pl, checkpatch.pl, cleanpatch They are located under tools/ directory in U-Boot now. But they were originally located under scripts/ directory in Linux Kernel. This commit moves them to the original location. It is true that binutils-version.sh and dtc-version.sh do not originate in Linux Kernel, but they should be moved by analogy to gcc-version.sh. Signed-off-by: Masahiro Yamada <yamada.m@jp.panasonic.com>