summaryrefslogtreecommitdiff
path: root/drivers/dio
AgeCommit message (Collapse)AuthorFilesLines
2022-11-09drivers: dio: fix possible memory leak in dio_init()Yang Yingliang1-0/+8
If device_register() returns error, the 'dev' and name needs be freed. Add a release function, and then call put_device() in the error path, so the name is freed in kobject_cleanup() and to the 'dev' is freed in release function. Fixes: 2e4c77bea3d8 ("m68k: dio - Kill warn_unused_result warnings") Fixes: 1fa5ae857bb1 ("driver core: get rid of struct device's bus_id string array") Signed-off-by: Yang Yingliang <yangyingliang@huawei.com> Link: https://lore.kernel.org/r/20221109064036.1835346-1-yangyingliang@huawei.com Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2022-05-19drivers: dio: add missing iounmap() in dio_init()Yang Yingliang1-1/+4
If kzalloc() fails, iounmap() need be called in error path. Signed-off-by: Yang Yingliang <yangyingliang@huawei.com> Link: https://lore.kernel.org/r/20220511064506.3398512-1-yangyingliang@huawei.com Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2022-02-04drivers: dio: Missing a blank line after declarationsAleksa Vučković1-0/+1
This patch fixes the checkpatch.pl error: < WARNING: Missing a blank line after declarations < #97: FILE: drivers/dio/dio.c:97: < + unsigned int i; < + for (i = 0; i < ARRAY_SIZE(names); i++) Signed-off-by: Aleksa Vučković <aleksav013@gmail.com> Link: https://lore.kernel.org/r/20220127135054.27281-7-aleksav013@gmail.com Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2022-02-04drivers: dio: code indent should use tabsAleksa Vučković1-46/+46
This patch fixes the checkpatch.pl error: < ERROR: code indent should use tabs where possible < #61: FILE: drivers/dio/dio.c:61: < + int id;$ < < WARNING: please, no spaces at the start of a line < #61: FILE: drivers/dio/dio.c:61: < + int id;$ < < ERROR: code indent should use tabs where possible < #62: FILE: drivers/dio/dio.c:62: < + const char *name;$ < < WARNING: please, no spaces at the start of a line < #62: FILE: drivers/dio/dio.c:62: < + const char *name;$ + 44 more errors of type "code indent should use tabs where possible" + 41 more warnings of type "please, no spaces at the start of a line" Signed-off-by: Aleksa Vučković <aleksav013@gmail.com> Link: https://lore.kernel.org/r/20220127135054.27281-6-aleksav013@gmail.com Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2022-02-04drivers: dio: space required after that ','Aleksa Vučković1-1/+1
This patch fixes the checkpatch.pl error: < ERROR: space required after that ',' (ctx:VxV) < #239: FILE: drivers/dio/dio.c:239: < + strcpy(dev->name,dio_getname(dev->id)); Signed-off-by: Aleksa Vučković <aleksav013@gmail.com> Link: https://lore.kernel.org/r/20220127135054.27281-5-aleksav013@gmail.com Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2022-02-04drivers: dio: space prohibited after parenthesisAleksa Vučković1-1/+1
This patch fixes the checkpatch.pl error: < ERROR: space prohibited after that open parenthesis '(' < #67: FILE: drivers/dio/dio.c:67: < +#define DIOFBNAME(x) { DIO_ENCODE_ID( DIO_ID_FBUFFER, DIO_ID2_##x), DIO_DESC2_##x } Signed-off-by: Aleksa Vučković <aleksav013@gmail.com> Link: https://lore.kernel.org/r/20220127135054.27281-4-aleksav013@gmail.com Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2022-02-04drivers: dio: trailing whitespaceAleksa Vučković1-12/+12
This patch fixes the checkpatch.pl errors and warnings: < ERROR: trailing whitespace < #5: FILE: drivers/dio/dio.c:5: < + * $ < < ERROR: trailing whitespace < #11: FILE: drivers/dio/dio.c:11: < + * This means that framebuffers should pass it as $ < < ERROR: trailing whitespace < #17: FILE: drivers/dio/dio.c:17: < + * Every DIO card has a fixed interrupt priority level. This function $ < < ERROR: trailing whitespace < #20: FILE: drivers/dio/dio.c:20: < + * Return a character string describing this board [might be "" if $ < < ERROR: trailing whitespace < #25: FILE: drivers/dio/dio.c:25: < + * This file is based on the way the Amiga port handles Zorro II cards, $ + 15 more errors and warnings of type "trailing whitespace" Signed-off-by: Aleksa Vučković <aleksav013@gmail.com> Link: https://lore.kernel.org/r/20220127135054.27281-3-aleksav013@gmail.com Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2022-02-04drivers: dio: brace should be on the previous lineAleksa Vučković1-8/+5
This patch fixes the checkpatch.pl errors and warnings: < ERROR: open brace '{' following struct go on the same line < +struct dioname < +{ < < ERROR: that open brace { should be on the previous line < +static struct dioname names[] = < +{ < < ERROR: that open brace { should be on the previous line < + for (scode = 0; scode < DIO_SCMAX; ++scode) < + { < < WARNING: braces {} are not necessary for any arm of this statement < + if (scode >= DIOII_SCBASE) { < [...] < + } else if (scode > DIO_SCMAX || scode < 0) < [...] < + else if (DIO_SCINHOLE(scode)) < [...] Signed-off-by: Aleksa Vučković <aleksav013@gmail.com> Link: https://lore.kernel.org/r/20220127135054.27281-2-aleksav013@gmail.com Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2022-02-04drivers: dio: Use <linux/io.h> instead <asm/io.h>Aleksa Vučković1-1/+1
This patch fixes the checkpatch.pl warning: < WARNING: Use #include <linux/io.h> instead of <asm/io.h> < #36: FILE: drivers/dio/dio.c:36: < +#include <asm/io.h> /* readb() */ Signed-off-by: Aleksa Vučković <aleksav013@gmail.com> Link: https://lore.kernel.org/r/20220127135054.27281-1-aleksav013@gmail.com Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2021-07-21dio: return -ENOMEM when kzalloc() failsSalah Triki1-1/+1
Return -ENOMEM when kzalloc() fails in order to inform the caller of the failure. Signed-off-by: Salah Triki <salah.triki@gmail.com> Link: https://lore.kernel.org/r/20210702133114.GA314157@pc Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2020-06-17maccess: rename probe_kernel_{read,write} to copy_{from,to}_kernel_nofaultChristoph Hellwig1-2/+4
Better describe what these functions do. Suggested-by: Linus Torvalds <torvalds@linux-foundation.org> Signed-off-by: Christoph Hellwig <hch@lst.de> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2020-03-09dio: Fix dio_bus_match() kerneldocGeert Uytterhoeven1-3/+3
The kerneldoc for dio_bus_match() was obviously copied from dio_match_device(), but wasnt't updated for the different calling context and semantics. Signed-off-by: Geert Uytterhoeven <geert@linux-m68k.org> Link: https://lore.kernel.org/r/20200112165613.20960-3-geert@linux-m68k.org
2020-03-09dio: Make dio_match_device() staticGeert Uytterhoeven1-2/+1
Unlike its PCI counterpart, dio_match_device() was never used outside the DIO bus code. Signed-off-by: Geert Uytterhoeven <geert@linux-m68k.org> Link: https://lore.kernel.org/r/20200112165613.20960-2-geert@linux-m68k.org
2019-05-21treewide: Add SPDX license identifier - Makefile/KconfigThomas Gleixner1-0/+1
Add SPDX license identifiers to all Make/Kconfig files which: - Have no license information of any form These files fall under the project license, GPL v2 only. The resulting SPDX license identifier is: GPL-2.0-only Signed-off-by: Thomas Gleixner <tglx@linutronix.de> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2019-01-21dio: Fix buffer overflow in case of unknown boardGeert Uytterhoeven1-2/+2
With gcc 8.2.0: drivers/dio/dio.c: In function ‘dio_init’: drivers/dio/dio.c:240:17: warning: ‘strcpy’ writing 69 or more bytes into a region of size 64 overflows the destination [-Wstringop-overflow=] strcpy(dev->name,dio_getname(dev->id)); ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ Indeed, if an unknown board is present, the target buffer will overflow. Shorten the unknown board name string to fix this, and declare it as an array while at it. Signed-off-by: Geert Uytterhoeven <geert@linux-m68k.org>
2017-11-02License cleanup: add SPDX GPL-2.0 license identifier to files with no licenseGreg Kroah-Hartman1-0/+1
Many source files in the tree are missing licensing information, which makes it harder for compliance tools to determine the correct license. By default all files without license information are under the default license of the kernel, which is GPL version 2. Update the files which contain no license information with the 'GPL-2.0' SPDX license identifier. The SPDX identifier is a legally binding shorthand, which can be used instead of the full boiler plate text. This patch is based on work done by Thomas Gleixner and Kate Stewart and Philippe Ombredanne. How this work was done: Patches were generated and checked against linux-4.14-rc6 for a subset of the use cases: - file had no licensing information it it. - file was a */uapi/* one with no licensing information in it, - file was a */uapi/* one with existing licensing information, Further patches will be generated in subsequent months to fix up cases where non-standard license headers were used, and references to license had to be inferred by heuristics based on keywords. The analysis to determine which SPDX License Identifier to be applied to a file was done in a spreadsheet of side by side results from of the output of two independent scanners (ScanCode & Windriver) producing SPDX tag:value files created by Philippe Ombredanne. Philippe prepared the base worksheet, and did an initial spot review of a few 1000 files. The 4.13 kernel was the starting point of the analysis with 60,537 files assessed. Kate Stewart did a file by file comparison of the scanner results in the spreadsheet to determine which SPDX license identifier(s) to be applied to the file. She confirmed any determination that was not immediately clear with lawyers working with the Linux Foundation. Criteria used to select files for SPDX license identifier tagging was: - Files considered eligible had to be source code files. - Make and config files were included as candidates if they contained >5 lines of source - File already had some variant of a license header in it (even if <5 lines). All documentation files were explicitly excluded. The following heuristics were used to determine which SPDX license identifiers to apply. - when both scanners couldn't find any license traces, file was considered to have no license information in it, and the top level COPYING file license applied. For non */uapi/* files that summary was: SPDX license identifier # files ---------------------------------------------------|------- GPL-2.0 11139 and resulted in the first patch in this series. If that file was a */uapi/* path one, it was "GPL-2.0 WITH Linux-syscall-note" otherwise it was "GPL-2.0". Results of that was: SPDX license identifier # files ---------------------------------------------------|------- GPL-2.0 WITH Linux-syscall-note 930 and resulted in the second patch in this series. - if a file had some form of licensing information in it, and was one of the */uapi/* ones, it was denoted with the Linux-syscall-note if any GPL family license was found in the file or had no licensing in it (per prior point). Results summary: SPDX license identifier # files ---------------------------------------------------|------ GPL-2.0 WITH Linux-syscall-note 270 GPL-2.0+ WITH Linux-syscall-note 169 ((GPL-2.0 WITH Linux-syscall-note) OR BSD-2-Clause) 21 ((GPL-2.0 WITH Linux-syscall-note) OR BSD-3-Clause) 17 LGPL-2.1+ WITH Linux-syscall-note 15 GPL-1.0+ WITH Linux-syscall-note 14 ((GPL-2.0+ WITH Linux-syscall-note) OR BSD-3-Clause) 5 LGPL-2.0+ WITH Linux-syscall-note 4 LGPL-2.1 WITH Linux-syscall-note 3 ((GPL-2.0 WITH Linux-syscall-note) OR MIT) 3 ((GPL-2.0 WITH Linux-syscall-note) AND MIT) 1 and that resulted in the third patch in this series. - when the two scanners agreed on the detected license(s), that became the concluded license(s). - when there was disagreement between the two scanners (one detected a license but the other didn't, or they both detected different licenses) a manual inspection of the file occurred. - In most cases a manual inspection of the information in the file resulted in a clear resolution of the license that should apply (and which scanner probably needed to revisit its heuristics). - When it was not immediately clear, the license identifier was confirmed with lawyers working with the Linux Foundation. - If there was any question as to the appropriate license identifier, the file was flagged for further research and to be revisited later in time. In total, over 70 hours of logged manual review was done on the spreadsheet to determine the SPDX license identifiers to apply to the source files by Kate, Philippe, Thomas and, in some cases, confirmation by lawyers working with the Linux Foundation. Kate also obtained a third independent scan of the 4.13 code base from FOSSology, and compared selected files where the other two scanners disagreed against that SPDX file, to see if there was new insights. The Windriver scanner is based on an older version of FOSSology in part, so they are related. Thomas did random spot checks in about 500 files from the spreadsheets for the uapi headers and agreed with SPDX license identifier in the files he inspected. For the non-uapi files Thomas did random spot checks in about 15000 files. In initial set of patches against 4.14-rc6, 3 files were found to have copy/paste license identifier errors, and have been fixed to reflect the correct identifier. Additionally Philippe spent 10 hours this week doing a detailed manual inspection and review of the 12,461 patched files from the initial patch version early this week with: - a full scancode scan run, collecting the matched texts, detected license ids and scores - reviewing anything where there was a license detected (about 500+ files) to ensure that the applied SPDX license was correct - reviewing anything where there was no detection but the patch license was not GPL-2.0 WITH Linux-syscall-note to ensure that the applied SPDX license was correct This produced a worksheet with 20 files needing minor correction. This worksheet was then exported into 3 different .csv files for the different types of files to be modified. These .csv files were then reviewed by Greg. Thomas wrote a script to parse the csv files and add the proper SPDX tag to the file, in the format that the file expected. This script was further refined by Greg based on the output to detect more types of files automatically and to distinguish between header and source .c files (which need different comment types.) Finally Greg ran the script using the .csv files to generate the patches. Reviewed-by: Kate Stewart <kstewart@linuxfoundation.org> Reviewed-by: Philippe Ombredanne <pombredanne@nexb.com> Reviewed-by: Thomas Gleixner <tglx@linutronix.de> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2017-05-27dio: use probe_kernel_read()Al Viro1-15/+2
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
2016-12-24Replace <asm/uaccess.h> with <linux/uaccess.h> globallyLinus Torvalds1-1/+1
This was entirely automated, using the script by Al: PATT='^[[:blank:]]*#[[:blank:]]*include[[:blank:]]*<asm/uaccess.h>' sed -i -e "s!$PATT!#include <linux/uaccess.h>!" \ $(git grep -l "$PATT"|grep -v ^include/linux/uaccess.h) to do the replacement at the end of the merge window. Requested-by: Al Viro <viro@zeniv.linux.org.uk> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2009-12-06m68k: don't export static inline functionsStephen Rothwell1-1/+0
These now cause errors due to changes present in linux-next: (__ksymtab_sorted+0x1258): undefined reference to `dio_dev_driver' (__ksymtab_sorted+0x4d48): undefined reference to `zorro_dev_driver' Signed-off-by: Stephen Rothwell <sfr@canb.auug.org.au> Signed-off-by: Geert Uytterhoeven <geert@linux-m68k.org>
2009-03-25dio: struct device - replace bus_id with dev_name(), dev_set_name()Kay Sievers1-2/+2
Acked-by: Greg Kroah-Hartman <gregkh@suse.de> Signed-off-by: Kay Sievers <kay.sievers@vrfy.org>
2009-01-12m68k: dio - Kill resource_size_t format warningsGeert Uytterhoeven1-1/+2
warning: format '%08lx' expects type 'long unsigned int', but argument 3 has type 'resource_size_t' Signed-off-by: Geert Uytterhoeven <geert@linux-m68k.org>
2009-01-12m68k: dio - Kill warn_unused_result warningsGeert Uytterhoeven2-9/+25
warning: ignoring return value of 'device_register', declared with attribute warn_unused_result warning: ignoring return value of 'device_create_file', declared with attribute warn_unused_result Signed-off-by: Geert Uytterhoeven <geert@linux-m68k.org>
2008-07-21dio: use dio_match_device() in dio_bus_match()Akinobu Mita1-13/+1
dio_bus_match() can use dio_match_device(). Signed-off-by: Akinobu Mita <akinobu.mita@gmail.com> Signed-off-by: Geert Uytterhoeven <geert@linux-m68k.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2008-02-05dio: ARRAY_SIZE() cleanupAlejandro Martinez Ruiz1-3/+1
[Geert: eliminate NUMNAMES, as suggested by Richard Knutsson ] [akpm@linux-foundation.org: coding-syle fixes] Signed-off-by: Alejandro Martinez Ruiz <alex@flawedcode.org> Signed-off-by: Geert Uytterhoeven <geert@linux-m68k.org> Cc: Richard Knutsson <ricknu-0@student.ltu.se> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2008-02-03dio: fix kernel-doc notationRandy Dunlap1-36/+34
Fix kernel-doc in drivers/dio/ so that it is formatted correctly and the parameter names match the function parameters. Signed-off-by: Randy Dunlap <randy.dunlap@oracle.com> Acked-By: Jochen Friedrich <jochen@scram.de> Signed-off-by: Adrian Bunk <bunk@kernel.org>
2006-03-25[PATCH] hp300: fix driver_register() return handling, remove dio_module_init()Bjorn Helgaas1-7/+2
Remove the assumption that driver_register() returns the number of devices bound to the driver. In fact, it returns zero for success or a negative error value. dio_module_init() used the device count to automatically unregister and unload drivers that found no devices. That might have worked at one time, but has been broken for some time because dio_register_driver() returned either a negative error or a positive count (never zero). So it could only unregister on failure, when it's not needed anyway. This functionality could be resurrected in individual drivers by counting devices in their .probe() methods. Signed-off-by: Bjorn Helgaas <bjorn.helgaas@hp.com> Cc: Philip Blundell <philb@gnu.org> Cc: Jochen Friedrich <jochen@scram.de> Cc: "Antonino A. Daplas" <adaplas@pol.net> Cc: Jeff Garzik <jeff@garzik.org> Signed-off-by: Andrew Morton <akpm@osdl.org> Signed-off-by: Linus Torvalds <torvalds@osdl.org>
2006-01-13[PATCH] Add dio_bus_type probe and remove methodsRussell King1-2/+2
Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
2005-11-07[PATCH] drivers/dio: kmalloc + memset -> kzalloc conversionDeepak Saxena1-2/+1
Signed-off-by: Deepak Saxena <dsaxena@plexity.net> Signed-off-by: Andrew Morton <akpm@osdl.org> Signed-off-by: Linus Torvalds <torvalds@osdl.org>
2005-06-21[PATCH] Driver Core: drivers/base - drivers/i2c/chips/adm1026.c: update ↵Yani Ioannou1-5/+5
device attribute callbacks Signed-off-by: Yani Ioannou <yani.ioannou@gmail.com> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
2005-04-17Linux-2.6.12-rc2Linus Torvalds4-0/+524
Initial git repository build. I'm not bothering with the full history, even though we have it. We can create a separate "historical" git archive of that later if we want to, and in the meantime it's about 3.2GB when imported into git - space that would just make the early git days unnecessarily complicated, when we don't have a lot of good infrastructure for it. Let it rip!