Input: nspire-keypad: Adjustments for nspire_keypad_probe()
Subsystems (3)
cover Input: nspire-keypad: Adjustments for nspire_keypad_probe()
From: Markus Elfring <[email protected]>
Date: Sat, 27 Jan 2018 10:48:28 +0100
Two update suggestions were taken into account
from static source code analysis.
Markus Elfring (2):
Delete an error message for a failed memory allocation Improve a size determination
drivers/input/keyboard/nspire-keypad.c | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-)
Signature · 1 line
2.16.1
PATCH 1/2 Input: nspire-keypad: Delete an error message for a failed memory allocation in nspire_keypad_probe()
From: Markus Elfring <[email protected]>
Date: Sat, 27 Jan 2018 10:33:37 +0100
Omit an extra message for a memory allocation failure in this function.
This issue was detected by using the Coccinelle software.
--- drivers/input/keyboard/nspire-keypad.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-)
drivers/input/keyboard/nspire-keypad.c +1 -3
@@ -175,10 +175,8 @@ static int nspire_keypad_probe(struct platform_device *pdev) keypad =devm_kzalloc (&pdev->dev,sizeof (struct nspire_keypad ),GFP_KERNEL ); -if (!keypad) { -dev_err (&pdev->dev,"failed to allocate keypad memory\n" ); +if (!keypad)return -ENOMEM ; - } keypad->row_shift =get_count_order (KEYPAD_BITMASK_COLS );
Signature · 1 line
2.16.1
PATCH 2/2 Input: nspire-keypad: Improve a size determination in nspire_keypad_probe()
In reply to SF Markus ElfringFrom: Markus Elfring <[email protected]>
Date: Sat, 27 Jan 2018 10:36:20 +0100
Replace the specification of a data structure by a pointer dereference as the parameter for the operator "sizeof" to make the corresponding size determination a bit safer according to the Linux coding style convention.
This issue was detected by using the Coccinelle software.
--- drivers/input/keyboard/nspire-keypad.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-)
drivers/input/keyboard/nspire-keypad.c +1 -2
@@ -173,8 +173,7 @@ static int nspire_keypad_probe(struct platform_device *pdev)return -EINVAL ; } - keypad =devm_kzalloc (&pdev->dev,sizeof (struct nspire_keypad ), -GFP_KERNEL ); + keypad =devm_kzalloc (&pdev->dev,sizeof (*keypad),GFP_KERNEL );if (!keypad)return -ENOMEM ;
Signature · 1 line
2.16.1