* [PATCH 0/2] tty/serial/sccnxp: Adjustments for sccnxp_probe()
@ 2017-12-07 21:18 SF Markus Elfring
2017-12-07 21:19 ` [PATCH 1/2] serial: sccnxp: Delete an error message for a failed memory allocation in sccnxp_probe() SF Markus Elfring
2017-12-07 21:20 ` [PATCH 2/2] serial: sccnxp: Improve a size determination " SF Markus Elfring
0 siblings, 2 replies; 3+ messages in thread
From: SF Markus Elfring @ 2017-12-07 21:18 UTC (permalink / raw)
To: linux-serial, Greg Kroah-Hartman, Jiri Slaby; +Cc: LKML, kernel-janitors
From: Markus Elfring <elfring@users.sourceforge.net>
Date: Thu, 7 Dec 2017 22:14:32 +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/tty/serial/sccnxp.c | 7 +++----
1 file changed, 3 insertions(+), 4 deletions(-)
--
2.15.1
^ permalink raw reply [flat|nested] 3+ messages in thread
* [PATCH 1/2] serial: sccnxp: Delete an error message for a failed memory allocation in sccnxp_probe()
2017-12-07 21:18 [PATCH 0/2] tty/serial/sccnxp: Adjustments for sccnxp_probe() SF Markus Elfring
@ 2017-12-07 21:19 ` SF Markus Elfring
2017-12-07 21:20 ` [PATCH 2/2] serial: sccnxp: Improve a size determination " SF Markus Elfring
1 sibling, 0 replies; 3+ messages in thread
From: SF Markus Elfring @ 2017-12-07 21:19 UTC (permalink / raw)
To: linux-serial, Greg Kroah-Hartman, Jiri Slaby; +Cc: LKML, kernel-janitors
From: Markus Elfring <elfring@users.sourceforge.net>
Date: Thu, 7 Dec 2017 21:55:09 +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/tty/serial/sccnxp.c | 5 ++---
1 file changed, 2 insertions(+), 3 deletions(-)
diff --git a/drivers/tty/serial/sccnxp.c b/drivers/tty/serial/sccnxp.c
index d6ae3086c2a2..ba1653ba5f37 100644
--- a/drivers/tty/serial/sccnxp.c
+++ b/drivers/tty/serial/sccnxp.c
@@ -857,10 +857,9 @@ static int sccnxp_probe(struct platform_device *pdev)
return PTR_ERR(membase);
s = devm_kzalloc(&pdev->dev, sizeof(struct sccnxp_port), GFP_KERNEL);
- if (!s) {
- dev_err(&pdev->dev, "Error allocating port structure\n");
+ if (!s)
return -ENOMEM;
- }
+
platform_set_drvdata(pdev, s);
spin_lock_init(&s->lock);
--
2.15.1
^ permalink raw reply related [flat|nested] 3+ messages in thread
* [PATCH 2/2] serial: sccnxp: Improve a size determination in sccnxp_probe()
2017-12-07 21:18 [PATCH 0/2] tty/serial/sccnxp: Adjustments for sccnxp_probe() SF Markus Elfring
2017-12-07 21:19 ` [PATCH 1/2] serial: sccnxp: Delete an error message for a failed memory allocation in sccnxp_probe() SF Markus Elfring
@ 2017-12-07 21:20 ` SF Markus Elfring
1 sibling, 0 replies; 3+ messages in thread
From: SF Markus Elfring @ 2017-12-07 21:20 UTC (permalink / raw)
To: linux-serial, Greg Kroah-Hartman, Jiri Slaby; +Cc: LKML, kernel-janitors
From: Markus Elfring <elfring@users.sourceforge.net>
Date: Thu, 7 Dec 2017 22:00:40 +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/tty/serial/sccnxp.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/tty/serial/sccnxp.c b/drivers/tty/serial/sccnxp.c
index ba1653ba5f37..21be1fb5fd6d 100644
--- a/drivers/tty/serial/sccnxp.c
+++ b/drivers/tty/serial/sccnxp.c
@@ -856,7 +856,7 @@ static int sccnxp_probe(struct platform_device *pdev)
if (IS_ERR(membase))
return PTR_ERR(membase);
- s = devm_kzalloc(&pdev->dev, sizeof(struct sccnxp_port), GFP_KERNEL);
+ s = devm_kzalloc(&pdev->dev, sizeof(*s), GFP_KERNEL);
if (!s)
return -ENOMEM;
--
2.15.1
^ permalink raw reply related [flat|nested] 3+ messages in thread
end of thread, other threads:[~2017-12-07 21:20 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-12-07 21:18 [PATCH 0/2] tty/serial/sccnxp: Adjustments for sccnxp_probe() SF Markus Elfring
2017-12-07 21:19 ` [PATCH 1/2] serial: sccnxp: Delete an error message for a failed memory allocation in sccnxp_probe() SF Markus Elfring
2017-12-07 21:20 ` [PATCH 2/2] serial: sccnxp: Improve a size determination " 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).