* [PATCH 0/2] n2rng: Fine-tuning for n2rng_probe() @ 2017-04-19 9:08 SF Markus Elfring 2017-04-19 9:10 ` [PATCH 1/2] n2rng: Use devm_kcalloc() in n2rng_probe() SF Markus Elfring 2017-04-19 9:11 ` [PATCH 2/2] n2rng: Combine substrings for two messages " SF Markus Elfring 0 siblings, 2 replies; 9+ messages in thread From: SF Markus Elfring @ 2017-04-19 9:08 UTC (permalink / raw) To: linux-crypto, David S. Miller, Herbert Xu, Matt Mackall, Shannon Nelson Cc: LKML, kernel-janitors From: Markus Elfring <elfring@users.sourceforge.net> Date: Wed, 19 Apr 2017 11:00:11 +0200 Two update suggestions were taken into account from static source code analysis. Markus Elfring (2): Use devm_kcalloc() Combine substrings for two messages drivers/char/hw_random/n2-drv.c | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) -- 2.12.2 ^ permalink raw reply [flat|nested] 9+ messages in thread
* [PATCH 1/2] n2rng: Use devm_kcalloc() in n2rng_probe() 2017-04-19 9:08 [PATCH 0/2] n2rng: Fine-tuning for n2rng_probe() SF Markus Elfring @ 2017-04-19 9:10 ` SF Markus Elfring 2017-04-19 15:24 ` Shannon Nelson 2017-04-21 13:16 ` Herbert Xu 2017-04-19 9:11 ` [PATCH 2/2] n2rng: Combine substrings for two messages " SF Markus Elfring 1 sibling, 2 replies; 9+ messages in thread From: SF Markus Elfring @ 2017-04-19 9:10 UTC (permalink / raw) To: linux-crypto, David S. Miller, Herbert Xu, Matt Mackall, Shannon Nelson Cc: LKML, kernel-janitors From: Markus Elfring <elfring@users.sourceforge.net> Date: Wed, 19 Apr 2017 10:30:47 +0200 * A multiplication for the size determination of a memory allocation indicated that an array data structure should be processed. Thus use the corresponding function "devm_kcalloc". * Replace the specification of a data structure by a pointer dereference to make the corresponding size determination a bit safer according to the Linux coding style convention. Signed-off-by: Markus Elfring <elfring@users.sourceforge.net> --- drivers/char/hw_random/n2-drv.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/drivers/char/hw_random/n2-drv.c b/drivers/char/hw_random/n2-drv.c index 31cbdbbaebfc..92dd4e925315 100644 --- a/drivers/char/hw_random/n2-drv.c +++ b/drivers/char/hw_random/n2-drv.c @@ -748,9 +748,7 @@ static int n2rng_probe(struct platform_device *op) dev_info(&op->dev, "Registered RNG HVAPI major %lu minor %lu\n", np->hvapi_major, np->hvapi_minor); - - np->units = devm_kzalloc(&op->dev, - sizeof(struct n2rng_unit) * np->num_units, + np->units = devm_kcalloc(&op->dev, np->num_units, sizeof(*np->units), GFP_KERNEL); err = -ENOMEM; if (!np->units) -- 2.12.2 ^ permalink raw reply related [flat|nested] 9+ messages in thread
* Re: [PATCH 1/2] n2rng: Use devm_kcalloc() in n2rng_probe() 2017-04-19 9:10 ` [PATCH 1/2] n2rng: Use devm_kcalloc() in n2rng_probe() SF Markus Elfring @ 2017-04-19 15:24 ` Shannon Nelson 2017-04-21 13:16 ` Herbert Xu 1 sibling, 0 replies; 9+ messages in thread From: Shannon Nelson @ 2017-04-19 15:24 UTC (permalink / raw) To: SF Markus Elfring, linux-crypto, David S. Miller, Herbert Xu, Matt Mackall Cc: LKML, kernel-janitors On 4/19/2017 2:10 AM, SF Markus Elfring wrote: > From: Markus Elfring <elfring@users.sourceforge.net> > Date: Wed, 19 Apr 2017 10:30:47 +0200 > > * A multiplication for the size determination of a memory allocation > indicated that an array data structure should be processed. > Thus use the corresponding function "devm_kcalloc". > > * Replace the specification of a data structure by a pointer dereference > to make the corresponding size determination a bit safer according to > the Linux coding style convention. > > Signed-off-by: Markus Elfring <elfring@users.sourceforge.net> Thanks Markus. Acked-by: Shannon Nelson <shannon.nelson@oracle.com> > --- > drivers/char/hw_random/n2-drv.c | 4 +--- > 1 file changed, 1 insertion(+), 3 deletions(-) > > diff --git a/drivers/char/hw_random/n2-drv.c b/drivers/char/hw_random/n2-drv.c > index 31cbdbbaebfc..92dd4e925315 100644 > --- a/drivers/char/hw_random/n2-drv.c > +++ b/drivers/char/hw_random/n2-drv.c > @@ -748,9 +748,7 @@ static int n2rng_probe(struct platform_device *op) > > dev_info(&op->dev, "Registered RNG HVAPI major %lu minor %lu\n", > np->hvapi_major, np->hvapi_minor); > - > - np->units = devm_kzalloc(&op->dev, > - sizeof(struct n2rng_unit) * np->num_units, > + np->units = devm_kcalloc(&op->dev, np->num_units, sizeof(*np->units), > GFP_KERNEL); > err = -ENOMEM; > if (!np->units) > ^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [PATCH 1/2] n2rng: Use devm_kcalloc() in n2rng_probe() 2017-04-19 9:10 ` [PATCH 1/2] n2rng: Use devm_kcalloc() in n2rng_probe() SF Markus Elfring 2017-04-19 15:24 ` Shannon Nelson @ 2017-04-21 13:16 ` Herbert Xu 1 sibling, 0 replies; 9+ messages in thread From: Herbert Xu @ 2017-04-21 13:16 UTC (permalink / raw) To: SF Markus Elfring Cc: linux-crypto, David S. Miller, Matt Mackall, Shannon Nelson, LKML, kernel-janitors On Wed, Apr 19, 2017 at 11:10:07AM +0200, SF Markus Elfring wrote: > From: Markus Elfring <elfring@users.sourceforge.net> > Date: Wed, 19 Apr 2017 10:30:47 +0200 > > * A multiplication for the size determination of a memory allocation > indicated that an array data structure should be processed. > Thus use the corresponding function "devm_kcalloc". > > * Replace the specification of a data structure by a pointer dereference > to make the corresponding size determination a bit safer according to > the Linux coding style convention. > > Signed-off-by: Markus Elfring <elfring@users.sourceforge.net> Patch applied. Thanks. -- Email: Herbert Xu <herbert@gondor.apana.org.au> Home Page: http://gondor.apana.org.au/~herbert/ PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txt ^ permalink raw reply [flat|nested] 9+ messages in thread
* [PATCH 2/2] n2rng: Combine substrings for two messages in n2rng_probe() 2017-04-19 9:08 [PATCH 0/2] n2rng: Fine-tuning for n2rng_probe() SF Markus Elfring 2017-04-19 9:10 ` [PATCH 1/2] n2rng: Use devm_kcalloc() in n2rng_probe() SF Markus Elfring @ 2017-04-19 9:11 ` SF Markus Elfring 2017-04-19 15:24 ` Shannon Nelson 2017-04-21 11:36 ` Herbert Xu 1 sibling, 2 replies; 9+ messages in thread From: SF Markus Elfring @ 2017-04-19 9:11 UTC (permalink / raw) To: linux-crypto, David S. Miller, Herbert Xu, Matt Mackall, Shannon Nelson Cc: LKML, kernel-janitors From: Markus Elfring <elfring@users.sourceforge.net> Date: Wed, 19 Apr 2017 10:50:04 +0200 The script "checkpatch.pl" pointed information out like the following. WARNING: quoted string split across lines Thus fix the affected source code places. Signed-off-by: Markus Elfring <elfring@users.sourceforge.net> --- drivers/char/hw_random/n2-drv.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/drivers/char/hw_random/n2-drv.c b/drivers/char/hw_random/n2-drv.c index 92dd4e925315..f3e67c768101 100644 --- a/drivers/char/hw_random/n2-drv.c +++ b/drivers/char/hw_random/n2-drv.c @@ -723,16 +723,16 @@ static int n2rng_probe(struct platform_device *op) if (sun4v_hvapi_register(HV_GRP_RNG, np->hvapi_major, &np->hvapi_minor)) { - dev_err(&op->dev, "Cannot register suitable " - "HVAPI version.\n"); + dev_err(&op->dev, + "Cannot register suitable HVAPI version.\n"); goto out; } } if (np->flags & N2RNG_FLAG_MULTI) { if (np->hvapi_major < 2) { - dev_err(&op->dev, "multi-unit-capable RNG requires " - "HVAPI major version 2 or later, got %lu\n", + dev_err(&op->dev, + "multi-unit-capable RNG requires HVAPI major version 2 or later, got %lu\n", np->hvapi_major); goto out_hvapi_unregister; } -- 2.12.2 ^ permalink raw reply related [flat|nested] 9+ messages in thread
* Re: [PATCH 2/2] n2rng: Combine substrings for two messages in n2rng_probe() 2017-04-19 9:11 ` [PATCH 2/2] n2rng: Combine substrings for two messages " SF Markus Elfring @ 2017-04-19 15:24 ` Shannon Nelson 2017-04-21 11:36 ` Herbert Xu 1 sibling, 0 replies; 9+ messages in thread From: Shannon Nelson @ 2017-04-19 15:24 UTC (permalink / raw) To: SF Markus Elfring, linux-crypto, David S. Miller, Herbert Xu, Matt Mackall Cc: LKML, kernel-janitors On 4/19/2017 2:11 AM, SF Markus Elfring wrote: > From: Markus Elfring <elfring@users.sourceforge.net> > Date: Wed, 19 Apr 2017 10:50:04 +0200 > > The script "checkpatch.pl" pointed information out like the following. > > WARNING: quoted string split across lines > > Thus fix the affected source code places. > > Signed-off-by: Markus Elfring <elfring@users.sourceforge.net> Thanks Markus. Acked-by: Shannon Nelson <shannon.nelson@oracle.com> > --- > drivers/char/hw_random/n2-drv.c | 8 ++++---- > 1 file changed, 4 insertions(+), 4 deletions(-) > > diff --git a/drivers/char/hw_random/n2-drv.c b/drivers/char/hw_random/n2-drv.c > index 92dd4e925315..f3e67c768101 100644 > --- a/drivers/char/hw_random/n2-drv.c > +++ b/drivers/char/hw_random/n2-drv.c > @@ -723,16 +723,16 @@ static int n2rng_probe(struct platform_device *op) > if (sun4v_hvapi_register(HV_GRP_RNG, > np->hvapi_major, > &np->hvapi_minor)) { > - dev_err(&op->dev, "Cannot register suitable " > - "HVAPI version.\n"); > + dev_err(&op->dev, > + "Cannot register suitable HVAPI version.\n"); > goto out; > } > } > > if (np->flags & N2RNG_FLAG_MULTI) { > if (np->hvapi_major < 2) { > - dev_err(&op->dev, "multi-unit-capable RNG requires " > - "HVAPI major version 2 or later, got %lu\n", > + dev_err(&op->dev, > + "multi-unit-capable RNG requires HVAPI major version 2 or later, got %lu\n", > np->hvapi_major); > goto out_hvapi_unregister; > } > ^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [PATCH 2/2] n2rng: Combine substrings for two messages in n2rng_probe() 2017-04-19 9:11 ` [PATCH 2/2] n2rng: Combine substrings for two messages " SF Markus Elfring 2017-04-19 15:24 ` Shannon Nelson @ 2017-04-21 11:36 ` Herbert Xu 2017-04-21 14:53 ` David Miller 2017-04-21 18:22 ` Joe Perches 1 sibling, 2 replies; 9+ messages in thread From: Herbert Xu @ 2017-04-21 11:36 UTC (permalink / raw) To: SF Markus Elfring Cc: linux-crypto, David S. Miller, Matt Mackall, Shannon Nelson, LKML, kernel-janitors On Wed, Apr 19, 2017 at 11:11:35AM +0200, SF Markus Elfring wrote: > From: Markus Elfring <elfring@users.sourceforge.net> > Date: Wed, 19 Apr 2017 10:50:04 +0200 > > The script "checkpatch.pl" pointed information out like the following. > > WARNING: quoted string split across lines > > Thus fix the affected source code places. > > Signed-off-by: Markus Elfring <elfring@users.sourceforge.net> This patch doesn't seem to add any value so I'm not taking it. Please don't send patches based purely on a checkpatch complaint. Thanks, -- Email: Herbert Xu <herbert@gondor.apana.org.au> Home Page: http://gondor.apana.org.au/~herbert/ PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txt ^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [PATCH 2/2] n2rng: Combine substrings for two messages in n2rng_probe() 2017-04-21 11:36 ` Herbert Xu @ 2017-04-21 14:53 ` David Miller 2017-04-21 18:22 ` Joe Perches 1 sibling, 0 replies; 9+ messages in thread From: David Miller @ 2017-04-21 14:53 UTC (permalink / raw) To: herbert Cc: elfring, linux-crypto, mpm, shannon.nelson, linux-kernel, kernel-janitors From: Herbert Xu <herbert@gondor.apana.org.au> Date: Fri, 21 Apr 2017 19:36:41 +0800 > On Wed, Apr 19, 2017 at 11:11:35AM +0200, SF Markus Elfring wrote: >> From: Markus Elfring <elfring@users.sourceforge.net> >> Date: Wed, 19 Apr 2017 10:50:04 +0200 >> >> The script "checkpatch.pl" pointed information out like the following. >> >> WARNING: quoted string split across lines >> >> Thus fix the affected source code places. >> >> Signed-off-by: Markus Elfring <elfring@users.sourceforge.net> > > This patch doesn't seem to add any value so I'm not taking it. > > Please don't send patches based purely on a checkpatch complaint. Thank you Herbert. ^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [PATCH 2/2] n2rng: Combine substrings for two messages in n2rng_probe() 2017-04-21 11:36 ` Herbert Xu 2017-04-21 14:53 ` David Miller @ 2017-04-21 18:22 ` Joe Perches 1 sibling, 0 replies; 9+ messages in thread From: Joe Perches @ 2017-04-21 18:22 UTC (permalink / raw) To: Herbert Xu, SF Markus Elfring Cc: linux-crypto, David S. Miller, Matt Mackall, Shannon Nelson, LKML, kernel-janitors On Fri, 2017-04-21 at 19:36 +0800, Herbert Xu wrote: > On Wed, Apr 19, 2017 at 11:11:35AM +0200, SF Markus Elfring wrote: > > From: Markus Elfring <elfring@users.sourceforge.net> > > Date: Wed, 19 Apr 2017 10:50:04 +0200 > > > > The script "checkpatch.pl" pointed information out like the following. > > > > WARNING: quoted string split across lines > > > > Thus fix the affected source code places. > > > > Signed-off-by: Markus Elfring <elfring@users.sourceforge.net> > > This patch doesn't seem to add any value so I'm not taking it. Your choice. The general reason to merge strings is in CodingStyle 2) Breaking long lines and strings [] never break user-visible strings such as printk messages, because that breaks the ability to grep for them. ^ permalink raw reply [flat|nested] 9+ messages in thread
end of thread, other threads:[~2017-04-21 18:32 UTC | newest] Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed) -- links below jump to the message on this page -- 2017-04-19 9:08 [PATCH 0/2] n2rng: Fine-tuning for n2rng_probe() SF Markus Elfring 2017-04-19 9:10 ` [PATCH 1/2] n2rng: Use devm_kcalloc() in n2rng_probe() SF Markus Elfring 2017-04-19 15:24 ` Shannon Nelson 2017-04-21 13:16 ` Herbert Xu 2017-04-19 9:11 ` [PATCH 2/2] n2rng: Combine substrings for two messages " SF Markus Elfring 2017-04-19 15:24 ` Shannon Nelson 2017-04-21 11:36 ` Herbert Xu 2017-04-21 14:53 ` David Miller 2017-04-21 18:22 ` Joe Perches
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).