- 23 Feb, 2020 1 commit
-
-
Kees Cook authored
Variables declared in a switch statement before any case statements cannot be automatically initialized with compiler instrumentation (as they are not part of any execution flow). With GCC's proposed automatic stack variable initialization feature, this triggers a warning (and they don't get initialized). Clang's automatic stack variable initialization (via CONFIG_INIT_STACK_ALL=y) doesn't throw a warning, but it also doesn't initialize such variables[1]. Note that these warnings (or silent skipping) happen before the dead-store elimination optimization phase, so even when the automatic initializations are later elided in favor of direct initializations, the warnings remain. To avoid these problems, move such variables into the "case" where they're used or lift them up into the main function body. drivers/tty/n_tty.c: In function ‘__process_echoes’: drivers/tty/n_tty.c:657:18: warning: statement will never be executed [-Wswitch-unreachable] 657 | unsigned int num_chars, num_bs; | ^~~~~~~~~ [1] https://bugs.llvm.org/show_bug.cgi?id=44916Reviewed-by: Jiri Slaby <jslaby@suse.cz> Signed-off-by: Kees Cook <keescook@chromium.org> Link: https://lore.kernel.org/r/20200220062313.69209-1-keescook@chromium.orgSigned-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
-
- 21 Feb, 2020 26 commits
-
-
Jiri Slaby authored
These two were macros. Switch them to static inlines, so that it's more understandable what they are doing. Signed-off-by: Jiri Slaby <jslaby@suse.cz> Link: https://lore.kernel.org/r/20200219073951.16151-2-jslaby@suse.czSigned-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
-
Jiri Slaby authored
Avoid global variables (namely sel_cons) by introducing vc_is_sel. It checks whether the parameter is the current selection console. This will help putting sel_cons to a struct later. Signed-off-by: Jiri Slaby <jslaby@suse.cz> Link: https://lore.kernel.org/r/20200219073951.16151-1-jslaby@suse.czSigned-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
-
Jiri Slaby authored
Signed-off-by: Jiri Slaby <jslaby@suse.cz> Link: https://lore.kernel.org/r/20200219084118.26491-24-jslaby@suse.czSigned-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
-
Jiri Slaby authored
Signed-off-by: Jiri Slaby <jslaby@suse.cz> Link: https://lore.kernel.org/r/20200219084118.26491-23-jslaby@suse.czSigned-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
-
Jiri Slaby authored
Signed-off-by: Jiri Slaby <jslaby@suse.cz> Link: https://lore.kernel.org/r/20200219084118.26491-22-jslaby@suse.czSigned-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
-
Jiri Slaby authored
Signed-off-by: Jiri Slaby <jslaby@suse.cz> Link: https://lore.kernel.org/r/20200219084118.26491-21-jslaby@suse.czSigned-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
-
Jiri Slaby authored
Do s@[ \t]\+$@@ s@ \+\t@\t@ on the file as there are many spaces at the begininning of lines and many spaces/tabs at EOLs. And vim screamed. git show -w is supposed to show no difference here. Signed-off-by: Jiri Slaby <jslaby@suse.cz> Link: https://lore.kernel.org/r/20200219084118.26491-20-jslaby@suse.czSigned-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
-
Jiri Slaby authored
* we mark the message in n_hdlc_tty_receive as error * we use __func__ instead of explicit function name * we switch the remaining prints to pr_* helpers Signed-off-by: Jiri Slaby <jslaby@suse.cz> Link: https://lore.kernel.org/r/20200219084118.26491-19-jslaby@suse.czSigned-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
-
Jiri Slaby authored
TTY_NO_WRITE_SPLIT is (always) defined in linux/tty.h, so no need to check for it. Signed-off-by: Jiri Slaby <jslaby@suse.cz> Link: https://lore.kernel.org/r/20200219084118.26491-18-jslaby@suse.czSigned-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
-
Jiri Slaby authored
They are in fact bools, so save some bytes (8B on x86_64). Also describe @woke_up as we know what it is. Signed-off-by: Jiri Slaby <jslaby@suse.cz> Link: https://lore.kernel.org/r/20200219084118.26491-17-jslaby@suse.czSigned-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
-
Jiri Slaby authored
This makes forward declarations unnecessary. So drop them. Signed-off-by: Jiri Slaby <jslaby@suse.cz> Link: https://lore.kernel.org/r/20200219084118.26491-16-jslaby@suse.czSigned-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
-
Jiri Slaby authored
Given both rx and tx allocations do the same, add a new helper (n_hdlc_alloc_buf) and use it for both of them. This cleans up n_hdlc_alloc slightly. Signed-off-by: Jiri Slaby <jslaby@suse.cz> Link: https://lore.kernel.org/r/20200219084118.26491-15-jslaby@suse.czSigned-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
-
Jiri Slaby authored
We got rid of backup_tty recently. Also, the tty layer ensures not to call other ldisc hooks after ldisc close. That means, all those tests are superfluous now so remove them. Note that we remove the magic check in write after schedule too. The tty cannot change during schedule. Signed-off-by: Jiri Slaby <jslaby@suse.cz> Link: https://lore.kernel.org/r/20200219084118.26491-14-jslaby@suse.czSigned-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
-
Jiri Slaby authored
It's not needed, as now it's clear, that it's always the same as the one passed from the tty layer. Signed-off-by: Jiri Slaby <jslaby@suse.cz> Link: https://lore.kernel.org/r/20200219084118.26491-13-jslaby@suse.czSigned-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
-
Jiri Slaby authored
Put the body of n_hdlc_release into the only caller. It can be seen, that the "if" is superfluous now -- the same happens few lines above in n_hdlc_tty_close already. So drop it. Drop also n_hdlc2tty macro as this was the only user. Signed-off-by: Jiri Slaby <jslaby@suse.cz> Link: https://lore.kernel.org/r/20200219084118.26491-12-jslaby@suse.czSigned-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
-
Jiri Slaby authored
It's simple tty->disc_data, but it obfuscates code. So expand it to all locations and drop it. Signed-off-by: Jiri Slaby <jslaby@suse.cz> Link: https://lore.kernel.org/r/20200219084118.26491-11-jslaby@suse.czSigned-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
-
Jiri Slaby authored
It's only set to NULL and never properly used. Signed-off-by: Jiri Slaby <jslaby@suse.cz> Link: https://lore.kernel.org/r/20200219084118.26491-10-jslaby@suse.czSigned-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
-
Jiri Slaby authored
They are only set to 0 and never read. Signed-off-by: Jiri Slaby <jslaby@suse.cz> Link: https://lore.kernel.org/r/20200219084118.26491-9-jslaby@suse.czSigned-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
-
Jiri Slaby authored
This makes the functions return immediatelly on invalid state. And we can push the indent of the later code one level left. Pass "-w" to "git show" to see we are changing only the conditions (and whitespace). Signed-off-by: Jiri Slaby <jslaby@suse.cz> Link: https://lore.kernel.org/r/20200219084118.26491-8-jslaby@suse.czSigned-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
-
Jiri Slaby authored
n_hdlc_release contains four loops to free each buffer list. Create a helper (n_hdlc_free_buf_list) and call it for every list instead. It makes n_hdlc_release more readable. We are switching from "for (;;)" to "do {} while (buf)" which avoids the "if (buf)" completely -- kfree is a nop for NULL pointers. Signed-off-by: Jiri Slaby <jslaby@suse.cz> Link: https://lore.kernel.org/r/20200219084118.26491-7-jslaby@suse.czSigned-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
-
Jiri Slaby authored
It is easier to read. And use MAX_HDLC_FRAME_SIZE instead of magic constant. Signed-off-by: Jiri Slaby <jslaby@suse.cz> Link: https://lore.kernel.org/r/20200219084118.26491-6-jslaby@suse.czSigned-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
-
Jiri Slaby authored
1) n_hdlc prints two lines during registration. Squeeze it into one. 2) prefix the error message with "N_HDLC: ", so that it's clear which ldisc failed to register. Signed-off-by: Jiri Slaby <jslaby@suse.cz> Link: https://lore.kernel.org/r/20200219084118.26491-5-jslaby@suse.czSigned-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
-
Jiri Slaby authored
These strings were put aside from prints to save some bytes after module load or when built-in -- they were freed after module load (__init ones) or when the driver is selected as built-in (__exit ones). The savings are negligible, but the code readability is worse by the order of magnitude. So put the strings where they belong. Note that it also used to make little sense putting const data in .data (the __exit case). While at it, switch to pr_info, pr_err, not using the KERN_INFO and _ERR directly. Signed-off-by: Jiri Slaby <jslaby@suse.cz> Link: https://lore.kernel.org/r/20200219084118.26491-4-jslaby@suse.czSigned-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
-
Jiri Slaby authored
With pr_debug we have a fine-grained control about debugging prints. So convert the use of global debuglevel variable and tests to a commonly used pr_debug. And drop debuglevel completely. This also implicitly adds a loglevel to the messages (KERN_DEBUG) as it was missing on most of them. And also use __func__ instead of function names explicitly typed. Signed-off-by: Jiri Slaby <jslaby@suse.cz> Link: https://lore.kernel.org/r/20200219084118.26491-3-jslaby@suse.czSigned-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
-
Jiri Slaby authored
VERSION and bset are unused. Remove them. Signed-off-by: Jiri Slaby <jslaby@suse.cz> Link: https://lore.kernel.org/r/20200219084118.26491-2-jslaby@suse.czSigned-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
-
Jiri Slaby authored
We can trace functions using ftrace, so there is no need for this additional prints. Remove them. We keep only those which print some additional info, not only function name & "entry"/"exit". Signed-off-by: Jiri Slaby <jslaby@suse.cz> Link: https://lore.kernel.org/r/20200219084118.26491-1-jslaby@suse.czSigned-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
-
- 20 Feb, 2020 2 commits
-
-
Greg Kroah-Hartman authored
Since a05025d0 ("tty: serial: samsung_tty: use standard debugging macros") this configuration option is not used at all, so remove it from the Kconfig file. Cc: linux-kernel@vger.kernel.org Cc: linux-serial@vger.kernel.org Cc: linux-samsung-soc@vger.kernel.org Cc: linux-arm-kernel@lists.infradead.org Cc: Jiri Slaby <jslaby@suse.com> Cc: Shinbeom Choi <sbeom.choi@samsung.com> Cc: HYUN-KI KOO <hyunki00.koo@samsung.com> Cc: Hyunki Koo <kkoos00@naver.com> Cc: Donghoon Yu <hoony.yu@samsung.com> Cc: Kukjin Kim <kgene@kernel.org> Reviewed-by: Krzysztof Kozlowski <krzk@kernel.org> Link: https://lore.kernel.org/r/20200220102628.3371996-2-gregkh@linuxfoundation.orgSigned-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
-
Greg Kroah-Hartman authored
There is no need to tie this driver to only a specific SoC, or compile test, so remove that dependancy from the Kconfig rules. Cc: linux-kernel@vger.kernel.org Cc: linux-serial@vger.kernel.org Cc: linux-samsung-soc@vger.kernel.org Cc: linux-arm-kernel@lists.infradead.org Cc: Jiri Slaby <jslaby@suse.com> Cc: Shinbeom Choi <sbeom.choi@samsung.com> Cc: HYUN-KI KOO <hyunki00.koo@samsung.com> Cc: Hyunki Koo <kkoos00@naver.com> Cc: Donghoon Yu <hoony.yu@samsung.com> Cc: Kukjin Kim <kgene@kernel.org> Reviewed-by: Krzysztof Kozlowski <krzk@kernel.org> Link: https://lore.kernel.org/r/20200220102628.3371996-1-gregkh@linuxfoundation.orgSigned-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
-
- 19 Feb, 2020 11 commits
-
-
Jiri Slaby authored
gsm_mux->escape is used as a bool, so treat it as such. Signed-off-by: Jiri Slaby <jslaby@suse.cz> Link: https://lore.kernel.org/r/20200219084949.28074-10-jslaby@suse.czSigned-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
-
Jiri Slaby authored
Both gsm_dlci->constipated and gsm_mux->constipated are used as bools, so treat them as such. Signed-off-by: Jiri Slaby <jslaby@suse.cz> Link: https://lore.kernel.org/r/20200219084949.28074-9-jslaby@suse.czSigned-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
-
Jiri Slaby authored
gsm_dlci->throttled is used as a bool, so treat it as such. Signed-off-by: Jiri Slaby <jslaby@suse.cz> Link: https://lore.kernel.org/r/20200219084949.28074-8-jslaby@suse.czSigned-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
-
Jiri Slaby authored
Both gsm_dlci->dead and gsm_mux->dead are used as bools, so treat them as such. Signed-off-by: Jiri Slaby <jslaby@suse.cz> Link: https://lore.kernel.org/r/20200219084949.28074-7-jslaby@suse.czSigned-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
-
Jiri Slaby authored
Signed-off-by: Jiri Slaby <jslaby@suse.cz> Link: https://lore.kernel.org/r/20200219084949.28074-6-jslaby@suse.czSigned-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
-
Jiri Slaby authored
sparse warns about incorrect types: n_gsm.c:2638:35: warning: incorrect type in argument 1 (different address spaces) n_gsm.c:2638:35: expected void [noderef] <asn:1> *to n_gsm.c:2638:35: got void * The ioctl handler casts its `arg' to (void *) without __user. Add that. Signed-off-by: Jiri Slaby <jslaby@suse.cz> Link: https://lore.kernel.org/r/20200219084949.28074-5-jslaby@suse.czSigned-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
-
Jiri Slaby authored
gsm_mux->state is clearly an enumeration. So introduce one and use it -- compiler now checks if valid values are assigned to the field. Note that a compiler warns about unhandled cases in switch. Add default cases with a pr_debug (which is not printed by default). The values of the states are preserved thanks to the nature of enum. Signed-off-by: Jiri Slaby <jslaby@suse.cz> Link: https://lore.kernel.org/r/20200219084949.28074-4-jslaby@suse.czSigned-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
-
Jiri Slaby authored
gsm_dlci->mode is clearly an enumeration. So introduce one and use it -- compiler now checks if valid values are assigned to the field. Signed-off-by: Jiri Slaby <jslaby@suse.cz> Link: https://lore.kernel.org/r/20200219084949.28074-3-jslaby@suse.czSigned-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
-
Jiri Slaby authored
gsm_dlci->state is clearly an enumeration. So introduce one and use it -- compiler now checks if valid values are assigned to the field. Note that a compiler warns about unhandled cases in switch. Add default cases with a pr_debug (which is not printed by default). Signed-off-by: Jiri Slaby <jslaby@suse.cz> Link: https://lore.kernel.org/r/20200219084949.28074-2-jslaby@suse.czSigned-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
-
Jiri Slaby authored
gsm_dlci->fifo always points to gsm_dlci->_fifo. So drop the pointer and rename _fifo to fifo. And update all the users (add & to them). Signed-off-by: Jiri Slaby <jslaby@suse.cz> Link: https://lore.kernel.org/r/20200219084949.28074-1-jslaby@suse.czSigned-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
-
Andy Shevchenko authored
Convert pr_*() calls to dev_*() ones. We have a port, we should use it. Suggested-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org> Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com> Link: https://lore.kernel.org/r/20200217114016.49856-5-andriy.shevchenko@linux.intel.comSigned-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
-