summaryrefslogtreecommitdiffstats
Commit message (Collapse)AuthorAgeFilesLines
* iwlwifi: mvm: enable scheduled scan on newest firmwareEmmanuel Grumbach2014-09-011-6/+8
| | | | | | | | | | Scheduled scan was disabled because of a bug in the firmware. The firmware reported support for this feature, but enabling it led to assertions. The bugs have been fixes in latest firmware versions, so that we can re-enable the feature on latest firmwares only. Signed-off-by: Emmanuel Grumbach <emmanuel.grumbach@intel.com>
* iwlwifi: bump firmware API version to 10 for 7000 and 8000Emmanuel Grumbach2014-09-012-3/+3
| | | | | | New firmware on the way. Signed-off-by: Emmanuel Grumbach <emmanuel.grumbach@intel.com>
* iwlwifi: Remove module build requirement for Intel Wireless WiFiMarcel Holtmann2014-08-311-2/+0
| | | | | | | | | | | The CONFIG_IWLDVM and CONFIG_IWLMVM currently have a "depends on m" as its requirement forcing it to be build as module. This is not needed and thus just remove it. Fixes: ae7486a2b734 ("iwlwifi: fix Kconfig issues") Signed-off-by: Marcel Holtmann <marcel@holtmann.org> [Squashed 2 commites for MVM and DVM] Signed-off-by: Emmanuel Grumbach <emmanuel.grumbach@intel.com>
* Revert "iwlwifi: dvm: don't enable CTS to self"Emmanuel Grumbach2014-08-311-0/+12
| | | | | | | | | This reverts commit 43d826ca5979927131685cc2092c7ce862cb91cd. This commit caused packet loss. Cc: <stable@vger.kernel.org> Signed-off-by: Emmanuel Grumbach <emmanuel.grumbach@intel.com>
* iwlwifi: mvm: disable scheduled scan to prevent firmware crashEmmanuel Grumbach2014-08-141-1/+2
| | | | | | | | | | There are firmwares which don't support scheduled scan. Disable it for now. Linus's system encoutered this issue. Thanks to David Spinadel for his help. Tested-by: Linus Torvalds <torvalds@linux-foundation.org> Signed-off-by: Emmanuel Grumbach <emmanuel.grumbach@intel.com>
* net: wireless: ipw2x00: ipw2200.c: Cleaning up missing null-terminate after ↵Rickard Strandqvist2014-08-111-0/+1
| | | | | | | | | strncpy call Added a guaranteed null-terminate after call to strncpy. Signed-off-by: Rickard Strandqvist <rickard_strandqvist@spectrumdigital.se> Signed-off-by: John W. Linville <linville@tuxdriver.com>
* brcmfmac: fix memory leakage in msgbufArend van Spriel2014-08-111-0/+4
| | | | | | | | | | | | | | | | | | | | | | | | The kbuild robot came up with the following warning: tree: .../kernel/git/linville/wireless-next.git master head: dc6be9f54a4ecb0a09765d1f515ed947d86b7528 commit: 9a1bb60250d2b6b546a62e5b73f55c4f1d22016b [5/13] brcmfmac: Adding msgbuf protocol. coccinelle warnings: drivers/net/wireless/brcm80211/brcmfmac/msgbuf.c:1309:1-28: alloc with no test, possible model on line 1318 Looking into the issue, it turned out that the referred allocation buffer was not being released in failure path nor upon module unload. Reported-by: Fengguang Wu <fengguang.wu@intel.com> Reviewed-by: Franky (Zhenhui) Lin <frankyl@broadcom.com> Reviewed-by: Daniel (Deognyoun) Kim <dekim@broadcom.com> Reviewed-by: Pieter-Paul Giesberts <pieterpg@broadcom.com> Signed-off-by: Arend van Spriel <arend@broadcom.com> Signed-off-by: John W. Linville <linville@tuxdriver.com>
* brcmfmac: fix curly brace mistake in brcmf_pcie_handle_mb_data()Arend van Spriel2014-08-111-1/+2
| | | | | | | | | | | | | | | Running coccicheck on brcm80211 drivers resulted in following report: $ make coccicheck MODE=report M=drivers/net/wireless/brcm80211 drivers/net/wireless/brcm80211/brcmfmac/pcie.c:595:2-43: code aligned with following code on line 596 It revealed that due to a merge failure a block statement lost its curly braces where it should not. Signed-off-by: Arend van Spriel <arend@broadcom.com> Signed-off-by: John W. Linville <linville@tuxdriver.com>
* carl9170: fix sending URBs with wrong type when using full-speedRonald Wahl2014-08-112-4/+28
| | | | | | | | | | | | | | | | | | | | | | | | The driver assumes that endpoint 4 is always an interrupt endpoint. Unfortunately the type differs between high-speed and full-speed configurations while in the former case it is indeed an interrupt endpoint this is not true for the latter case - here it is a bulk endpoint. When sending URBs with the wrong type the kernel will generate a warning message including backtrace. In this specific case there will be a huge amount of warnings which can bring the system to freeze. To fix this we are now sending URBs to endpoint 4 using the type found in the endpoint descriptor. A side note: The carl9170 firmware currently specifies endpoint 4 as interrupt endpoint even in the full-speed configuration but this has no relevance because before this firmware is loaded the endpoint type is as described above and after the firmware is running the stick is not reenumerated and so the old descriptor is used. Signed-off-by: Ronald Wahl <ronald.wahl@raritan.com> Cc: <stable@vger.kernel.org> Signed-off-by: John W. Linville <linville@tuxdriver.com>
* Merge branch 'akpm' (patchbomb from Andrew Morton)Linus Torvalds2014-08-06156-2919/+3930
|\ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Merge incoming from Andrew Morton: - Various misc things. - arch/sh updates. - Part of ocfs2. Review is slow. - Slab updates. - Most of -mm. - printk updates. - lib/ updates. - checkpatch updates. * emailed patches from Andrew Morton <akpm@linux-foundation.org>: (226 commits) checkpatch: update $declaration_macros, add uninitialized_var checkpatch: warn on missing spaces in broken up quoted checkpatch: fix false positives for --strict "space after cast" test checkpatch: fix false positive MISSING_BREAK warnings with --file checkpatch: add test for native c90 types in unusual order checkpatch: add signed generic types checkpatch: add short int to c variable types checkpatch: add for_each tests to indentation and brace tests checkpatch: fix brace style misuses of else and while checkpatch: add --fix option for a couple OPEN_BRACE misuses checkpatch: use the correct indentation for which() checkpatch: add fix_insert_line and fix_delete_line helpers checkpatch: add ability to insert and delete lines to patch/file checkpatch: add an index variable for fixed lines checkpatch: warn on break after goto or return with same tab indentation checkpatch: emit a warning on file add/move/delete checkpatch: add test for commit id formatting style in commit log checkpatch: emit fewer kmalloc_array/kcalloc conversion warnings checkpatch: improve "no space after cast" test checkpatch: allow multiple const * types ...
| * checkpatch: update $declaration_macros, add uninitialized_varJoe Perches2014-08-061-5/+6
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Using uninitialized_var reports a false positive for "Missing blank line after declarations". Fix it by adding uninitialized_var to the $declaration_macros exceptions list. Move the macro list after $Type is declared. Add optional prefixes to DECLARE_<FOO> and DEFINE_<BAR> macro declarations to allow forms like: MLX4_DECLARE_DOORBELL_LOCK Signed-off-by: Joe Perches <joe@perches.com> Reported-by: Dotan Barak <dotanb@mellanox.com> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
| * checkpatch: warn on missing spaces in broken up quotedDan Carpenter2014-08-061-0/+6
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Checkpatch already complains when people break up quoted strings but it's still pretty common. One mistake that people often make is they leave out the space character between the two strings. This check adds around 450 new warnings and has a low rate of false positives. Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com> Cc: Andy Whitcroft <apw@canonical.com> Acked-by: Joe Perches <joe@perches.com> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
| * checkpatch: fix false positives for --strict "space after cast" testJoe Perches2014-08-061-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | Commit 89da401f6cff ("checkpatch: improve "no space after cast" test") in -next improved the cast test for non pointer types, but also introduced false positives for some types of static inlines. Add a test for an open brace to the exclusions to avoid these false positives. Signed-off-by: Joe Perches <joe@perches.com> Reported-by: Hartley Sweeten <HartleyS@visionengravers.com> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
| * checkpatch: fix false positive MISSING_BREAK warnings with --fileJoe Perches2014-08-061-2/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Using --file mode can give false positives with MISSING_BREAK fall-through warnings on simple but long multiple consecutive case statements. Look for all lines before a case statement for a switch or a statement when using --file mode. Fix a misspelling of preceded while there. Signed-off-by: Joe Perches <joe@perches.com> Reported-by: Lee Jones <lee.jones@linaro.org> Acked-by: Lee Jones <lee.jones@linaro.org> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
| * checkpatch: add test for native c90 types in unusual orderJoe Perches2014-08-061-0/+44
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | c90 section "6.7.2 Type Specifiers" says: "type specifiers may occur in any order" That means that: short int is the same as int short unsigned short int is the same as int unsigned short etc... checkpatch currently parses only a subset of these allowed types. For instance: "unsigned short" and "signed short" are found by checkpatch as a specific type, but none of the or "int short" or "int signed short" variants are found. Add another table for the "kernel style misordered" variants. Add this misordered table to the findable types. Warn when the misordered style is used. This improves the "Missing a blank line after declarations" test as it depends on the correct parsing of the $Declare variable which looks for "$Type $Ident;" (ie: declarations like "int foo;"). Signed-off-by: Joe Perches <joe@perches.com> Acked-by: Andy Whitcroft <apw@canonical.com> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
| * checkpatch: add signed generic typesJoe Perches2014-08-061-9/+9
| | | | | | | | | | | | | | | | | | | | | | | | Current generic types are unsigned or unspecified. Add signed to the types. Reorder the types to find the longest match first. Signed-off-by: Joe Perches <joe@perches.com> Acked-by: Andy Whitcroft <apw@canonical.com> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
| * checkpatch: add short int to c variable typesJoe Perches2014-08-061-0/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | short int is one of the 6.7.2 c90 types. Find it appropriately. This fixes a defect in checkpatch where it suggests that a line break after declaration is required using an input like: int foo; short int bar; Without this change, it warns on the short int line. Signed-off-by: Joe Perches <joe@perches.com> Reported-by: Hartley Sweeten <HartleyS@visionengravers.com> Acked-by: Andy Whitcroft <apw@canonical.com> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
| * checkpatch: add for_each tests to indentation and brace testsJoe Perches2014-08-061-2/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | All the various for_each loop macros were not tested for trailing brace on the following lines and for bad indentation. Add them. Signed-off-by: Joe Perches <joe@perches.com> Reported-by: Greg KH <gregkh@linuxfoundation.org> Cc: Andy Whitcroft <apw@canonical.com Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
| * checkpatch: fix brace style misuses of else and whileJoe Perches2014-08-061-8/+30
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Add --fix corrections for ELSE_AFTER_BRACE and WHILE_AFTER_BRACE misuses. if (x) { ... } else { ... } is corrected to if (x) { ... } else { ... } and do { ... } while (x); is corrected to do { ... } while (x); Signed-off-by: Joe Perches <joe@perches.com> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
| * checkpatch: add --fix option for a couple OPEN_BRACE misusesJoe Perches2014-08-061-5/+28
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Style misuses of these types are corrected: typedef struct foo { int bar; }; int foo(int bar) { return bar+1; } int foo(int bar) { return bar+1; } Signed-off-by: Joe Perches <joe@perches.com> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
| * checkpatch: use the correct indentation for which()Joe Perches2014-08-061-6/+6
| | | | | | | | | | | | | | | | | | | | | | I copied the which subroutine from get_maintainer.pl. Unfortunately, get_maintainer uses a 4 space indentation so use the proper tab indentation instead. Signed-off-by: Joe Perches <joe@perches.com> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
| * checkpatch: add fix_insert_line and fix_delete_line helpersJoe Perches2014-08-061-36/+29
| | | | | | | | | | | | | | | | | | Neaten the uses of patch/file line insertions or deletions. Hide the mechanism used. Signed-off-by: Joe Perches <joe@perches.com> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
| * checkpatch: add ability to insert and delete lines to patch/fileJoe Perches2014-08-061-11/+130
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This can be valuable to insert or delete blank lines as well as fix misplaced brace or else uses. Store indexes of lines to be added/deleted and the new lines. When creating the --fix file, insert or delete the appropriate lines and update the patch range information. Signed-off-by: Joe Perches <joe@perches.com> Cc: Andy Whitcroft <apw@canonical.com> Cc: Dan Carpenter <dan.carpenter@oracle.com> Cc: Josh Triplett <josh@joshtriplett.org> Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
| * checkpatch: add an index variable for fixed linesJoe Perches2014-08-061-54/+60
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Make the fix code a bit easier to read. This should also start to allow an easier mechanism to insert/delete lines eventually too. Signed-off-by: Joe Perches <joe@perches.com> Cc: Andy Whitcroft <apw@canonical.com> Cc: Dan Carpenter <dan.carpenter@oracle.com> Cc: Josh Triplett <josh@joshtriplett.org> Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
| * checkpatch: warn on break after goto or return with same tab indentationJoe Perches2014-08-061-0/+10
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Using break; after a goto or return is unnecessary so emit a warning when the break is at the same indent level. So this emits a warning on: switch (foo) { case 1: goto err; break; } but not on: switch (foo) { case 1: if (bar()) goto err; break; } Signed-off-by: Joe Perches <joe@perches.com> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
| * checkpatch: emit a warning on file add/move/deleteJoe Perches2014-08-061-1/+12
| | | | | | | | | | | | | | | | | | | | | | | | | | Whenever files are added, moved, or deleted, the MAINTAINERS file patterns can be out of sync or outdated. To try to keep MAINTAINERS more up-to-date, add a one-time warning whenever a patch does any of those. Signed-off-by: Joe Perches <joe@perches.com> Acked-by: Andy Whitcroft <apw@canonical.com> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
| * checkpatch: add test for commit id formatting style in commit logJoe Perches2014-08-061-0/+54
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Commit logs have various forms of commit id references. Try to standardize on a 12 character long lower case commit id along with a description of parentheses and the quoted subject line. ie: commit 0123456789ab ("commit description") If git and a git tree exists, look up the commit id and emit the appropriate line as part of the message. Signed-off-by: Joe Perches <joe@perches.com> Requested-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
| * checkpatch: emit fewer kmalloc_array/kcalloc conversion warningsJoe Perches2014-08-061-8/+9
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Avoid matching allocs that appear to be known small multiplications of a sizeof with a constant because gcc as of 4.8 cannot optimize the code in a calloc() exactly the same way as an alloc(). Look for numeric constants or what appear to be upper case only macro #defines. Signed-off-by: Joe Perches <joe@perches.com> Reported-by: Theodore Ts'o <tytso@mit.edu> Original-patch-by: Fabian Frederick <fabf@skynet.be> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
| * checkpatch: improve "no space after cast" testJoe Perches2014-08-061-3/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | This --strict test previously worked only for what appeared to be cast to pointer types. Make it work for all casts. Also, there's no reason to show the previous line for this type of message, so don't. Signed-off-by: Joe Perches <joe@perches.com> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
| * checkpatch: allow multiple const * typesJoe Perches2014-08-061-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | checkpatch's $Type variable does not match declarations of multiple const * types. This can produce false positives for things like: $ ./scripts/checkpatch.pl -f drivers/staging/comedi/comedidev.h WARNING: Missing a blank line after declarations #60: FILE: drivers/staging/comedi/comedidev.h:60: + const struct comedi_lrange *range_table; + const struct comedi_lrange *const *range_table_list; Fix the $Type variable to support matching multiple "* const" uses. Signed-off-by: Joe Perches <joe@perches.com> Reported-by: Hartley Sweeten <HartleyS@visionengravers.com> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
| * checkpatch: warn on unnecessary parentheses around references of foo->barJoe Perches2014-08-061-0/+8
| | | | | | | | | | | | | | | | | | Parentheses around &(foo->bar) and *(foo->bar) are unnecessary. Emit a --strict only message on these uses. Signed-off-by: Joe Perches <joe@perches.com> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
| * checkpatch: quiet Kconfig help message checkingJoe Perches2014-08-061-3/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | Editing Kconfig dependencies can emit unnecessary messages about missing or too short help entries. Only emit the message when adding help sections to Kconfig files. Signed-off-by: Joe Perches <joe@perches.com> Reported-by: Jean Delvare <jdelvare@suse.de> Tested-by: Jean Delvare <jdelvare@suse.de> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
| * checkpatch: change blank line after declaration type to "LINE_SPACING"Joe Perches2014-08-061-1/+1
| | | | | | | | | | | | | | | | Make it consistent with the other missing or multiple blank line tests. Signed-off-by: Joe Perches <joe@perches.com> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
| * checkpatch: add a multiple blank lines testJoe Perches2014-08-061-0/+11
| | | | | | | | | | | | | | | | | | Multiple consecutive blank lines waste screen space. Emit a --strict only message with these blank lines. Signed-off-by: Joe Perches <joe@perches.com> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
| * checkpatch: add test for blank lines after function/struct/union/enumJoe Perches2014-08-061-0/+16
| | | | | | | | | | | | | | | | | | | | | | Add a --strict test asking for a blank line after function/struct/union/enum declarations. Allow exceptions for several attributes and macro uses. Signed-off-by: Joe Perches <joe@perches.com> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
| * checkpatch.pl: also suggest 'else if' when if follows braceRasmus Villemoes2014-08-061-1/+1
| | | | | | | | | | | | | | | | | | | | This might help a kernel hacker think twice before blindly adding a newline. Signed-off-by: Rasmus Villemoes <linux@rasmusvillemoes.dk> Acked-by: Joe Perches <joe@perches.com> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
| * checkpatch: ignore email headers betterJoe Perches2014-08-061-2/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | There are some patches created by git format-patch that when scanned by checkpatch report errors on lines like To: address.tld This is a checkpatch false positive. Improve the logic a bit to ignore folded email headers to avoid emitting these messages. Signed-off-by: Joe Perches <joe@perches.com> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
| * checkpatch: fix function pointers in blank line needed after declarations testJoe Perches2014-08-061-0/+4
| | | | | | | | | | | | | | | | | | | | Add a function pointer declaration check to the test for blank line needed after declarations. Signed-off-by: Joe Perches <joe@perches.com> Reported-by: Bruce W Allan <bruce.w.allan@intel.com> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
| * checkpatch: fix complex macro false positive for escaped constant charJoe Perches2014-08-061-1/+1
| | | | | | | | | | | | | | | | A single escaped constant char is not a complex macro. Signed-off-by: Joe Perches <joe@perches.com> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
| * checkpatch: warn on unnecessary else after return or breakJoe Perches2014-08-061-0/+10
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Using an else following a break or return can unnecessarily indent code blocks. ie: for (i = 0; i < 100; i++) { int foo = bar(); if (foo < 1) break; else usleep(1); } is generally better written as: for (i = 0; i < 100; i++) { int foo = bar(); if (foo < 1) break; usleep(1); } Warn when a bare else statement is preceded by a break or return indented 1 tab more than the else. Signed-off-by: Joe Perches <joe@perches.com> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
| * checkpatch: attempt to find unnecessary 'out of memory' messagesJoe Perches2014-08-061-0/+17
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Logging messages that show some type of "out of memory" error are generally unnecessary as there is a generic message and a stack dump done by the memory subsystem. These messages generally increase kernel size without much added value. Emit a warning on these types of messages. This test looks for any inserted message function, then looks at the previous line for an "if (!foo)" or "if (foo == NULL)" test and then looks at the preceding statement for an allocation function like "foo = kmalloc()" ie: this code matches: foo = kmalloc(); if (foo == NULL) { printk("Out of memory\n"); return -ENOMEM; } This test is very crude and incomplete. This test can miss quite a lot of of OOM messages that do not have this specific form. ie: this code does not match: foo = kmalloc(); if (!foo) { rtn = -ENOMEM; printk("Out of memory!\n"); goto out; } This test could also be a false positive when the logging message itself does not specify anything about memory, but I did not find any false positives in my limited testing. spatch could be a better solution but correctness seems non-trivial for that tool too. Signed-off-by: Joe Perches <joe@perches.com> Acked-by: Dan Carpenter <dan.carpenter@oracle.com> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
| * lib: bitmap: add missing mask in bitmap_andnotRasmus Villemoes2014-08-062-3/+6
| | | | | | | | | | | | | | | | | | | | Apparently, bitmap_andnot is supposed to return whether the new bitmap is empty. But it didn't take potential garbage bits in the last word into account. Signed-off-by: Rasmus Villemoes <linux@rasmusvillemoes.dk> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
| * lib: bitmap: add missing mask in bitmap_andRasmus Villemoes2014-08-062-3/+6
| | | | | | | | | | | | | | | | | | | | Apparently, bitmap_and is supposed to return whether the new bitmap is empty. But it didn't take potential garbage bits in the last word into account. Signed-off-by: Rasmus Villemoes <linux@rasmusvillemoes.dk> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
| * lib: bitmap: add missing mask in bitmap_shift_rightRasmus Villemoes2014-08-061-1/+1
| | | | | | | | | | | | | | | | | | There is no guarantee that *src does not contain garbage bits outside the lower nbits, so we need to mask it before the shift-and-assign. Signed-off-by: Rasmus Villemoes <linux@rasmusvillemoes.dk> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
| * lib: bitmap: micro-optimize bitmap_allocate_regionRasmus Villemoes2014-08-061-2/+1
| | | | | | | | | | | | | | | | | | __reg_op(..., REG_OP_ALLOC) always returns 0, so we might as well use that and save an instruction. Signed-off-by: Rasmus Villemoes <linux@rasmusvillemoes.dk> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
| * lib: bitmap: change parameter of bitmap_*_region to unsignedRasmus Villemoes2014-08-062-9/+9
| | | | | | | | | | | | | | | | | | | | | | | | | | Changing the pos parameter of __reg_op to unsigned allows the compiler to generate slightly smaller and simpler code. Also update its callers bitmap_*_region to receive and pass unsigned int. The return types of bitmap_find_free_region and bitmap_allocate_region are still int to allow a negative error code to be returned. An int is certainly capable of representing any realistic return value. Signed-off-by: Rasmus Villemoes <linux@rasmusvillemoes.dk> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
| * lib: bitmap: fix typo in kerneldoc for bitmap_pos_to_ordRasmus Villemoes2014-08-061-1/+1
| | | | | | | | | | | | | | | | | | A few lines above, it was stated that positions for non-set bits are mapped to -1, which is obviously also what the code does. Signed-off-by: Rasmus Villemoes <linux@rasmusvillemoes.dk> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
| * lib: bitmap: simplify bitmap_parselistRasmus Villemoes2014-08-061-7/+2
| | | | | | | | | | | | | | | | | | | | | | We want len to be the index of the first '\n', or the length of the string if there is no newline. This is a good example of the usefulness of strchrnul(). Use that instead, thus eliminating a branch and a call to strlen(). Signed-off-by: Rasmus Villemoes <linux@rasmusvillemoes.dk> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
| * lib: bitmap: make the start index of bitmap_clear unsignedRasmus Villemoes2014-08-062-6/+6
| | | | | | | | | | | | | | | | | | | | | | | | The compiler can generate slightly smaller and simpler code when it knows that "start" is non-negative. Also, use the names "start" and "len" for the two parameters for consistency with bitmap_set. Signed-off-by: Rasmus Villemoes <linux@rasmusvillemoes.dk> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
| * lib: bitmap: make the start index of bitmap_set unsignedRasmus Villemoes2014-08-062-6/+6
| | | | | | | | | | | | | | | | | | | | | | | | The compiler can generate slightly smaller and simpler code when it knows that "start" is non-negative. Also, use the names "start" and "len" for the two parameters in both header file and implementation, instead of the previous mix. Signed-off-by: Rasmus Villemoes <linux@rasmusvillemoes.dk> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
OpenPOWER on IntegriCloud