Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1291247 > unrolled thread
| Started by | Nicholas Mc Guire <hofrat@osadl.org> |
|---|---|
| First post | 2015-12-14 16:00 +0100 |
| Last post | 2015-12-14 19:20 +0100 |
| Articles | 4 — 4 participants |
Back to article view | Back to linux.kernel
This discussion starts older than the indexed window; earlier articles aren't shown. The article labeled Started by
below is the oldest one visible, not the original post.
[PATCH 1/3] staging/rdma/hfi1: consolidate kmalloc_array+memset into kcalloc Nicholas Mc Guire <hofrat@osadl.org> - 2015-12-14 16:00 +0100
RE: [PATCH 1/3] staging/rdma/hfi1: consolidate kmalloc_array+memset into kcalloc "Marciniszyn, Mike" <mike.marciniszyn@intel.com> - 2015-12-14 16:30 +0100
Re: [PATCH 1/3] staging/rdma/hfi1: consolidate kmalloc_array+memset into kcalloc Nicholas Mc Guire <der.herr@hofr.at> - 2015-12-14 18:50 +0100
Re: [PATCH 1/3] staging/rdma/hfi1: consolidate kmalloc_array+memset into kcalloc Dan Carpenter <dan.carpenter@oracle.com> - 2015-12-14 19:20 +0100
| From | Nicholas Mc Guire <hofrat@osadl.org> |
|---|---|
| Date | 2015-12-14 16:00 +0100 |
| Subject | [PATCH 1/3] staging/rdma/hfi1: consolidate kmalloc_array+memset into kcalloc |
| Message-ID | <qFCLw-7vq-9@gated-at.bofh.it> |
rather than using kmalloc_array + memset it seems cleaner to simply use
kcalloc which will deliver memory set to zero.
Signed-off-by: Nicholas Mc Guire <hofrat@osadl.org>
---
Patch was compile tested with: x86_64_defconfig
CONFIG_INFINIBAND=m, CONFIG_STAGING=y, CONFIG_STAGING_RDMA=m
Patch is against linux-next (localversion-next is -next-20151214)
drivers/staging/rdma/hfi1/chip.c | 3 +--
1 file changed, 1 insertion(+), 2 deletions(-)
diff --git a/drivers/staging/rdma/hfi1/chip.c b/drivers/staging/rdma/hfi1/chip.c
index dc69159..31eec8a 100644
--- a/drivers/staging/rdma/hfi1/chip.c
+++ b/drivers/staging/rdma/hfi1/chip.c
@@ -10128,8 +10128,7 @@ static void init_qos(struct hfi1_devdata *dd, u32 first_ctxt)
goto bail;
if (num_vls * qpns_per_vl > dd->chip_rcv_contexts)
goto bail;
- rsmmap = kmalloc_array(NUM_MAP_REGS, sizeof(u64), GFP_KERNEL);
- memset(rsmmap, rxcontext, NUM_MAP_REGS * sizeof(u64));
+ rsmmap = kcalloc(NUM_MAP_REGS, sizeof(u64), GFP_KERNEL);
/* init the local copy of the table */
for (i = 0, ctxt = first_ctxt; i < num_vls; i++) {
unsigned tctxt;
--
1.7.10.4
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
[toc] | [next] | [standalone]
| From | "Marciniszyn, Mike" <mike.marciniszyn@intel.com> |
|---|---|
| Date | 2015-12-14 16:30 +0100 |
| Subject | RE: [PATCH 1/3] staging/rdma/hfi1: consolidate kmalloc_array+memset into kcalloc |
| Message-ID | <qFDey-7Vd-15@gated-at.bofh.it> |
| In reply to | #1291247 |
> --- a/drivers/staging/rdma/hfi1/chip.c
> +++ b/drivers/staging/rdma/hfi1/chip.c
> @@ -10128,8 +10128,7 @@ static void init_qos(struct hfi1_devdata *dd,
> u32 first_ctxt)
> goto bail;
> if (num_vls * qpns_per_vl > dd->chip_rcv_contexts)
> goto bail;
> - rsmmap = kmalloc_array(NUM_MAP_REGS, sizeof(u64),
> GFP_KERNEL);
> - memset(rsmmap, rxcontext, NUM_MAP_REGS * sizeof(u64));
> + rsmmap = kcalloc(NUM_MAP_REGS, sizeof(u64), GFP_KERNEL);
> /* init the local copy of the table */
> for (i = 0, ctxt = first_ctxt; i < num_vls; i++) {
> unsigned tctxt;
> --
I'm NAKing this.
There is a chip specific difference that accounts for the current code.
Mike
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
[toc] | [prev] | [next] | [standalone]
| From | Nicholas Mc Guire <der.herr@hofr.at> |
|---|---|
| Date | 2015-12-14 18:50 +0100 |
| Subject | Re: [PATCH 1/3] staging/rdma/hfi1: consolidate kmalloc_array+memset into kcalloc |
| Message-ID | <qFFq3-Q8-29@gated-at.bofh.it> |
| In reply to | #1291275 |
On Mon, Dec 14, 2015 at 03:28:46PM +0000, Marciniszyn, Mike wrote:
> > --- a/drivers/staging/rdma/hfi1/chip.c
> > +++ b/drivers/staging/rdma/hfi1/chip.c
> > @@ -10128,8 +10128,7 @@ static void init_qos(struct hfi1_devdata *dd,
> > u32 first_ctxt)
> > goto bail;
> > if (num_vls * qpns_per_vl > dd->chip_rcv_contexts)
> > goto bail;
> > - rsmmap = kmalloc_array(NUM_MAP_REGS, sizeof(u64),
> > GFP_KERNEL);
> > - memset(rsmmap, rxcontext, NUM_MAP_REGS * sizeof(u64));
> > + rsmmap = kcalloc(NUM_MAP_REGS, sizeof(u64), GFP_KERNEL);
> > /* init the local copy of the table */
> > for (i = 0, ctxt = first_ctxt; i < num_vls; i++) {
> > unsigned tctxt;
> > --
>
> I'm NAKing this.
>
> There is a chip specific difference that accounts for the current code.
>
I obviously made a real mess here.
I incorrectly concluded that rxcontext is 0 which it is not in some cases
sorry for the noise.
thx!
hofrat
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
[toc] | [prev] | [next] | [standalone]
| From | Dan Carpenter <dan.carpenter@oracle.com> |
|---|---|
| Date | 2015-12-14 19:20 +0100 |
| Subject | Re: [PATCH 1/3] staging/rdma/hfi1: consolidate kmalloc_array+memset into kcalloc |
| Message-ID | <qFFT3-1gj-5@gated-at.bofh.it> |
| In reply to | #1291380 |
On Mon, Dec 14, 2015 at 05:41:23PM +0000, Nicholas Mc Guire wrote: > I obviously made a real mess here. > I incorrectly concluded that rxcontext is 0 which it is not in some cases Yep. Plus you build tested it but assumed that the unused variable warning must have been there in the original... I've done that for static checker warnings. Lesson learned, hopefully. regards, dan carpenter -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[toc] | [prev] | [standalone]
Back to top | Article view | linux.kernel
csiph-web