* [PATCH 0/3] Input-bcm5974: Adjustments for two function implementations
@ 2018-01-24 20:29 SF Markus Elfring
2018-01-24 20:30 ` [PATCH 1/3] Input: bcm5974: Delete an error message for a failed memory allocation in bcm5974_wellspring_mode() SF Markus Elfring
` (2 more replies)
0 siblings, 3 replies; 4+ messages in thread
From: SF Markus Elfring @ 2018-01-24 20:29 UTC (permalink / raw)
To: linux-input, Dmitry Torokhov, Henrik Rydberg; +Cc: LKML, kernel-janitors
From: Markus Elfring <elfring@users.sourceforge.net>
Date: Wed, 24 Jan 2018 21:25:24 +0100
Three update suggestions were taken into account
from static source code analysis.
Markus Elfring (3):
Delete an error message for a failed memory allocation
in bcm5974_wellspring_mode()
Return directly after a failed kmalloc() in bcm5974_wellspring_mode()
Improve a size determination in bcm5974_probe()
drivers/input/mouse/bcm5974.c | 9 +++------
1 file changed, 3 insertions(+), 6 deletions(-)
--
2.16.1
^ permalink raw reply [flat|nested] 4+ messages in thread
* [PATCH 1/3] Input: bcm5974: Delete an error message for a failed memory allocation in bcm5974_wellspring_mode()
2018-01-24 20:29 [PATCH 0/3] Input-bcm5974: Adjustments for two function implementations SF Markus Elfring
@ 2018-01-24 20:30 ` SF Markus Elfring
2018-01-24 20:31 ` [PATCH 2/3] Input: bcm5974: Return directly after a failed kmalloc() " SF Markus Elfring
2018-01-24 20:32 ` [PATCH 3/3] Input: bcm5974: Improve a size determination in bcm5974_probe() SF Markus Elfring
2 siblings, 0 replies; 4+ messages in thread
From: SF Markus Elfring @ 2018-01-24 20:30 UTC (permalink / raw)
To: linux-input, Dmitry Torokhov, Henrik Rydberg; +Cc: LKML, kernel-janitors
From: Markus Elfring <elfring@users.sourceforge.net>
Date: Wed, 24 Jan 2018 21:09:28 +0100
Omit an extra message for a memory allocation failure in this function.
This issue was detected by using the Coccinelle software.
Signed-off-by: Markus Elfring <elfring@users.sourceforge.net>
---
drivers/input/mouse/bcm5974.c | 1 -
1 file changed, 1 deletion(-)
diff --git a/drivers/input/mouse/bcm5974.c b/drivers/input/mouse/bcm5974.c
index d0122134f320..994805513df9 100644
--- a/drivers/input/mouse/bcm5974.c
+++ b/drivers/input/mouse/bcm5974.c
@@ -670,7 +670,6 @@ static int bcm5974_wellspring_mode(struct bcm5974 *dev, bool on)
data = kmalloc(c->um_size, GFP_KERNEL);
if (!data) {
- dev_err(&dev->intf->dev, "out of memory\n");
retval = -ENOMEM;
goto out;
}
--
2.16.1
^ permalink raw reply related [flat|nested] 4+ messages in thread
* [PATCH 2/3] Input: bcm5974: Return directly after a failed kmalloc() in bcm5974_wellspring_mode()
2018-01-24 20:29 [PATCH 0/3] Input-bcm5974: Adjustments for two function implementations SF Markus Elfring
2018-01-24 20:30 ` [PATCH 1/3] Input: bcm5974: Delete an error message for a failed memory allocation in bcm5974_wellspring_mode() SF Markus Elfring
@ 2018-01-24 20:31 ` SF Markus Elfring
2018-01-24 20:32 ` [PATCH 3/3] Input: bcm5974: Improve a size determination in bcm5974_probe() SF Markus Elfring
2 siblings, 0 replies; 4+ messages in thread
From: SF Markus Elfring @ 2018-01-24 20:31 UTC (permalink / raw)
To: linux-input, Dmitry Torokhov, Henrik Rydberg; +Cc: LKML, kernel-janitors
From: Markus Elfring <elfring@users.sourceforge.net>
Date: Wed, 24 Jan 2018 21:14:51 +0100
Return directly after a call of the function "kmalloc" failed
at the beginning.
Signed-off-by: Markus Elfring <elfring@users.sourceforge.net>
---
drivers/input/mouse/bcm5974.c | 6 ++----
1 file changed, 2 insertions(+), 4 deletions(-)
diff --git a/drivers/input/mouse/bcm5974.c b/drivers/input/mouse/bcm5974.c
index 994805513df9..685f56c08931 100644
--- a/drivers/input/mouse/bcm5974.c
+++ b/drivers/input/mouse/bcm5974.c
@@ -669,10 +669,8 @@ static int bcm5974_wellspring_mode(struct bcm5974 *dev, bool on)
return 0;
data = kmalloc(c->um_size, GFP_KERNEL);
- if (!data) {
- retval = -ENOMEM;
- goto out;
- }
+ if (!data)
+ return -ENOMEM;
/* read configuration */
size = usb_control_msg(dev->udev, usb_rcvctrlpipe(dev->udev, 0),
--
2.16.1
^ permalink raw reply related [flat|nested] 4+ messages in thread
* [PATCH 3/3] Input: bcm5974: Improve a size determination in bcm5974_probe()
2018-01-24 20:29 [PATCH 0/3] Input-bcm5974: Adjustments for two function implementations SF Markus Elfring
2018-01-24 20:30 ` [PATCH 1/3] Input: bcm5974: Delete an error message for a failed memory allocation in bcm5974_wellspring_mode() SF Markus Elfring
2018-01-24 20:31 ` [PATCH 2/3] Input: bcm5974: Return directly after a failed kmalloc() " SF Markus Elfring
@ 2018-01-24 20:32 ` SF Markus Elfring
2 siblings, 0 replies; 4+ messages in thread
From: SF Markus Elfring @ 2018-01-24 20:32 UTC (permalink / raw)
To: linux-input, Dmitry Torokhov, Henrik Rydberg; +Cc: LKML, kernel-janitors
From: Markus Elfring <elfring@users.sourceforge.net>
Date: Wed, 24 Jan 2018 21:21:11 +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.
Signed-off-by: Markus Elfring <elfring@users.sourceforge.net>
---
drivers/input/mouse/bcm5974.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/input/mouse/bcm5974.c b/drivers/input/mouse/bcm5974.c
index 685f56c08931..c827b31c8530 100644
--- a/drivers/input/mouse/bcm5974.c
+++ b/drivers/input/mouse/bcm5974.c
@@ -915,7 +915,7 @@ static int bcm5974_probe(struct usb_interface *iface,
cfg = bcm5974_get_config(udev);
/* allocate memory for our device state and initialize it */
- dev = kzalloc(sizeof(struct bcm5974), GFP_KERNEL);
+ dev = kzalloc(sizeof(*dev), GFP_KERNEL);
input_dev = input_allocate_device();
if (!dev || !input_dev) {
dev_err(&iface->dev, "out of memory\n");
--
2.16.1
^ permalink raw reply related [flat|nested] 4+ messages in thread
end of thread, other threads:[~2018-01-24 20:32 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-01-24 20:29 [PATCH 0/3] Input-bcm5974: Adjustments for two function implementations SF Markus Elfring
2018-01-24 20:30 ` [PATCH 1/3] Input: bcm5974: Delete an error message for a failed memory allocation in bcm5974_wellspring_mode() SF Markus Elfring
2018-01-24 20:31 ` [PATCH 2/3] Input: bcm5974: Return directly after a failed kmalloc() " SF Markus Elfring
2018-01-24 20:32 ` [PATCH 3/3] Input: bcm5974: Improve a size determination in bcm5974_probe() SF Markus Elfring
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).