History log of /linux-master/drivers/dio/dio.c
Revision Date Author Comments
# e63e9939 08-Nov-2022 Yang Yingliang <yangyingliang@huawei.com>

drivers: dio: fix possible memory leak in dio_init()

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>


# 077f5d90 11-May-2022 Yang Yingliang <yangyingliang@huawei.com>

drivers: dio: add missing iounmap() in dio_init()

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>


# aafce7bc 27-Jan-2022 Aleksa Vučković <aleksav013@gmail.com>

drivers: dio: Missing a blank line after declarations

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>


# dffae938 27-Jan-2022 Aleksa Vučković <aleksav013@gmail.com>

drivers: dio: code indent should use tabs

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>


# f8b187c2 27-Jan-2022 Aleksa Vučković <aleksav013@gmail.com>

drivers: dio: space required after that ','

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>


# c3c61385 27-Jan-2022 Aleksa Vučković <aleksav013@gmail.com>

drivers: dio: space prohibited after parenthesis

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>


# 7649cb6f 27-Jan-2022 Aleksa Vučković <aleksav013@gmail.com>

drivers: dio: trailing whitespace

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>


# 8a4606c6 27-Jan-2022 Aleksa Vučković <aleksav013@gmail.com>

drivers: dio: brace should be on the previous line

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>


# 10f4629f 27-Jan-2022 Aleksa Vučković <aleksav013@gmail.com>

drivers: dio: Use <linux/io.h> instead <asm/io.h>

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>


# d1d26f40 02-Jul-2021 Salah Triki <salah.triki@gmail.com>

dio: return -ENOMEM when kzalloc() fails

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>


# fe557319 17-Jun-2020 Christoph Hellwig <hch@lst.de>

maccess: rename probe_kernel_{read,write} to copy_{from,to}_kernel_nofault

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>


# 627f192d 08-Jan-2019 Geert Uytterhoeven <geert@linux-m68k.org>

dio: Fix buffer overflow in case of unknown board

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>


# b2441318 01-Nov-2017 Greg Kroah-Hartman <gregkh@linuxfoundation.org>

License cleanup: add SPDX GPL-2.0 license identifier to files with no license

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>


# c02205e9 26-May-2017 Al Viro <viro@zeniv.linux.org.uk>

dio: use probe_kernel_read()

Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>


# 7c0f6ba6 24-Dec-2016 Linus Torvalds <torvalds@linux-foundation.org>

Replace <asm/uaccess.h> with <linux/uaccess.h> globally

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>


# 9591463a 24-Mar-2009 Kay Sievers <kay.sievers@vrfy.org>

dio: struct device - replace bus_id with dev_name(), dev_set_name()

Acked-by: Greg Kroah-Hartman <gregkh@suse.de>
Signed-off-by: Kay Sievers <kay.sievers@vrfy.org>


# 2e4c77be 30-Dec-2008 Geert Uytterhoeven <geert@linux-m68k.org>

m68k: dio - Kill warn_unused_result warnings

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>


# 0a8320b0 04-Feb-2008 Alejandro Martinez Ruiz <alex@flawedcode.org>

dio: ARRAY_SIZE() cleanup

[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>


# e66860cb 07-Nov-2005 Deepak Saxena <dsaxena@plexity.net>

[PATCH] drivers/dio: kmalloc + memset -> kzalloc conversion

Signed-off-by: Deepak Saxena <dsaxena@plexity.net>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>


# 1da177e4 16-Apr-2005 Linus Torvalds <torvalds@ppc970.osdl.org>

Linux-2.6.12-rc2

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!