Skip to contentSkip to conversation

drm/i915/pmu: fix noderef.cocci warnings

PATCH In review Tvrtko Ursulin 3 participants 5 messages Jan 12, 2018

Subsystems (2)
lore
Share & tools
lore

Tvrtko Ursulin

author maintainer
#0 lore raw

PATCH 1/2 drm/i915/pmu: fix noderef.cocci warnings

From: Fengguang Wu <[email protected]>

drivers/gpu/drm/i915/i915_pmu.c:795:34-40: ERROR: application of sizeof to pointer

sizeof when applied to a pointer typed expression gives the size of the pointer

Generated by: scripts/coccinelle/misc/noderef.cocci

Fixes 109ec558370f ("drm/i915/pmu: Only enumerate available counters in sysfs")
---
 drivers/gpu/drm/i915/i915_pmu.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/gpu/drm/i915/i915_pmu.c +1 -1
index 95ab5e28f5be..9be4f5201e41 100644
@@ -794,7 +794,7 @@ create_event_attributes(struct drm_i915_private *i915)
 		goto err_alloc;
 
 	/* Max one pointer of each attribute type plus a termination entry. */
-	attr = kzalloc((count * 2 + 1) * sizeof(attr), GFP_KERNEL);
+	attr = kzalloc((count * 2 + 1) * sizeof(*attr), GFP_KERNEL);
 	if (!attr)
 		goto err_alloc;
 
Signature · 6 lines
2.14.1

_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
author maintainer
#1 lore raw

PATCH 2/2 drm/i915/pmu: Use kcalloc instead of kzalloc

From: Tvrtko Ursulin <[email protected]>

kcalloc is preffered for allocating arrays.

---
 drivers/gpu/drm/i915/i915_pmu.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)
drivers/gpu/drm/i915/i915_pmu.c +3 -3
index 9be4f5201e41..065a28c713c4 100644
@@ -785,16 +785,16 @@ create_event_attributes(struct drm_i915_private *i915)
 	}
 
 	/* Allocate attribute objects and table. */
-	i915_attr = kzalloc(count * sizeof(*i915_attr), GFP_KERNEL);
+	i915_attr = kcalloc(count, sizeof(*i915_attr), GFP_KERNEL);
 	if (!i915_attr)
 		goto err_alloc;
 
-	pmu_attr = kzalloc(count * sizeof(*pmu_attr), GFP_KERNEL);
+	pmu_attr = kcalloc(count, sizeof(*pmu_attr), GFP_KERNEL);
 	if (!pmu_attr)
 		goto err_alloc;
 
 	/* Max one pointer of each attribute type plus a termination entry. */
-	attr = kzalloc((count * 2 + 1) * sizeof(*attr), GFP_KERNEL);
+	attr = kcalloc(count * 2 + 1, sizeof(*attr), GFP_KERNEL);
 	if (!attr)
 		goto err_alloc;
 
Signature · 6 lines
2.14.1

_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
Reviewed-by on v1 2/2
#2 lore raw

Re: [PATCH 2/2] drm/i915/pmu: Use kcalloc instead of kzalloc

Quoted 7 lines · Tvrtko Ursulin

From: Tvrtko Ursulin <[email protected]>

kcalloc is preffered for allocating arrays.

Quoted 30 lines
---
 drivers/gpu/drm/i915/i915_pmu.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)
drivers/gpu/drm/i915/i915_pmu.c +3 -3
index 9be4f5201e41..065a28c713c4 100644
@@ -785,16 +785,16 @@ create_event_attributes(struct drm_i915_private *i915)
 	}
 
 	/* Allocate attribute objects and table. */
-	i915_attr = kzalloc(count * sizeof(*i915_attr), GFP_KERNEL);
+	i915_attr = kcalloc(count, sizeof(*i915_attr), GFP_KERNEL);
 	if (!i915_attr)
 		goto err_alloc;
 
-	pmu_attr = kzalloc(count * sizeof(*pmu_attr), GFP_KERNEL);
+	pmu_attr = kcalloc(count, sizeof(*pmu_attr), GFP_KERNEL);
 	if (!pmu_attr)
 		goto err_alloc;
 
 	/* Max one pointer of each attribute type plus a termination entry. */
-	attr = kzalloc((count * 2 + 1) * sizeof(*attr), GFP_KERNEL);
+	attr = kcalloc(count * 2 + 1, sizeof(*attr), GFP_KERNEL);
 	if (!attr)
 		goto err_alloc;
 
Signature · 1 line
2.14.1
Signature · 6 lines
Ville Syrjälä
Intel OTC
_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
#3 lore raw

✓ Fi.CI.BAT: success for series starting with [1/2] drm/i915/pmu: fix noderef.cocci warnings

In reply to Tvrtko Ursulin
== Series Details ==

== Series Details ==

Series: series starting with [1/2] drm/i915/pmu: fix noderef.cocci warnings
URL : https://patchwork.freedesktop.org/series/36421/
State : success

== Summary ==

Series 36421v1 series starting with [1/2] drm/i915/pmu: fix noderef.cocci warnings
https://patchwork.freedesktop.org/api/1.0/series/36421/revisions/1/mbox/

Test debugfs_test:

        Subgroup read_all_entries:
                dmesg-warn -> DMESG-FAIL (fi-elk-e7500) fdo#103989
                incomplete -> PASS       (fi-snb-2520m) fdo#103713

fdo#103989 https://bugs.freedesktop.org/show_bug.cgi?id=103989
fdo#103713 https://bugs.freedesktop.org/show_bug.cgi?id=103713

fi-bdw-5557u     total:288  pass:267  dwarn:0   dfail:0   fail:0   skip:21  time:425s
fi-bdw-gvtdvm    total:288  pass:264  dwarn:0   dfail:0   fail:0   skip:24  time:423s
fi-blb-e6850     total:288  pass:223  dwarn:1   dfail:0   fail:0   skip:64  time:371s
fi-bsw-n3050     total:288  pass:242  dwarn:0   dfail:0   fail:0   skip:46  time:489s
fi-bwr-2160      total:288  pass:183  dwarn:0   dfail:0   fail:0   skip:105 time:284s
fi-bxt-dsi       total:288  pass:258  dwarn:0   dfail:0   fail:0   skip:30  time:482s
fi-bxt-j4205     total:288  pass:259  dwarn:0   dfail:0   fail:0   skip:29  time:485s
fi-byt-j1900     total:288  pass:253  dwarn:0   dfail:0   fail:0   skip:35  time:479s
fi-byt-n2820     total:288  pass:249  dwarn:0   dfail:0   fail:0   skip:39  time:455s
fi-elk-e7500     total:224  pass:168  dwarn:9   dfail:1   fail:0   skip:45 
fi-gdg-551       total:288  pass:179  dwarn:0   dfail:0   fail:1   skip:108 time:275s
fi-glk-1         total:288  pass:260  dwarn:0   dfail:0   fail:0   skip:28  time:512s
fi-hsw-4770      total:288  pass:261  dwarn:0   dfail:0   fail:0   skip:27  time:391s
fi-hsw-4770r     total:288  pass:261  dwarn:0   dfail:0   fail:0   skip:27  time:399s
fi-ilk-650       total:288  pass:228  dwarn:0   dfail:0   fail:0   skip:60  time:411s
fi-ivb-3520m     total:288  pass:259  dwarn:0   dfail:0   fail:0   skip:29  time:462s
fi-ivb-3770      total:288  pass:255  dwarn:0   dfail:0   fail:0   skip:33  time:411s
fi-kbl-7500u     total:288  pass:263  dwarn:1   dfail:0   fail:0   skip:24  time:466s
fi-kbl-7560u     total:288  pass:269  dwarn:0   dfail:0   fail:0   skip:19  time:494s
fi-kbl-7567u     total:288  pass:268  dwarn:0   dfail:0   fail:0   skip:20  time:457s
fi-kbl-r         total:288  pass:260  dwarn:1   dfail:0   fail:0   skip:27  time:499s
fi-pnv-d510      total:288  pass:222  dwarn:1   dfail:0   fail:0   skip:65  time:584s
fi-skl-6260u     total:288  pass:268  dwarn:0   dfail:0   fail:0   skip:20  time:430s
fi-skl-6600u     total:288  pass:261  dwarn:0   dfail:0   fail:0   skip:27  time:508s
fi-skl-6700hq    total:288  pass:262  dwarn:0   dfail:0   fail:0   skip:26  time:526s
fi-skl-6700k2    total:288  pass:264  dwarn:0   dfail:0   fail:0   skip:24  time:493s
fi-skl-6770hq    total:288  pass:268  dwarn:0   dfail:0   fail:0   skip:20  time:485s
fi-skl-gvtdvm    total:288  pass:265  dwarn:0   dfail:0   fail:0   skip:23  time:431s
fi-snb-2520m     total:288  pass:244  dwarn:0   dfail:0   fail:0   skip:44  time:521s
fi-snb-2600      total:288  pass:248  dwarn:0   dfail:0   fail:0   skip:40  time:408s
Blacklisted hosts:
fi-cfl-s2        total:288  pass:262  dwarn:0   dfail:0   fail:0   skip:26  time:566s
fi-glk-dsi       total:288  pass:258  dwarn:0   dfail:0   fail:0   skip:30  time:475s

353fa2d3affffef324005ed2553da6eb174a2f0b drm-tip: 2018y-01m-12d-09h-21m-50s UTC integration manifest 4ab53646a746 drm/i915/pmu: Use kcalloc instead of kzalloc
e55379036539 drm/i915/pmu: fix noderef.cocci warnings

== Logs ==

For more details see: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_7657/issues.html
_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

#4 lore raw

✓ Fi.CI.IGT: success for series starting with [1/2] drm/i915/pmu: fix noderef.cocci warnings

In reply to Tvrtko Ursulin
== Series Details ==

== Series Details ==

Series: series starting with [1/2] drm/i915/pmu: fix noderef.cocci warnings
URL : https://patchwork.freedesktop.org/series/36421/
State : success

== Summary ==

Test perf:

        Subgroup polling:
                pass       -> FAIL       (shard-hsw) fdo#102252
Test kms_frontbuffer_tracking:
        Subgroup fbc-1p-offscren-pri-shrfb-draw-blt:
                pass       -> FAIL       (shard-snb) fdo#101623 +1
        Subgroup fbc-1p-primscrn-pri-indfb-draw-pwrite:
                fail       -> PASS       (shard-snb) fdo#103167
Test kms_cursor_crc:
        Subgroup cursor-128x128-suspend:
                pass       -> SKIP       (shard-hsw) fdo#103540
Test gem_eio:
        Subgroup in-flight-contexts:
                dmesg-warn -> PASS       (shard-snb) fdo#104058 +1
Test gem_wait:
        Subgroup write-busy-bsd:
                skip       -> PASS       (shard-snb)
Test gem_pwrite_snooped:
                fail       -> PASS       (shard-snb) fdo#104600
Test perf_pmu:
        Subgroup busy-check-all-rcs0:
                skip       -> PASS       (shard-snb)
Test gem_exec_parallel:
        Subgroup default-fds:
                skip       -> PASS       (shard-snb)
Test gem_partial_pwrite_pread:
        Subgroup write:
                skip       -> PASS       (shard-snb)
Test prime_vgem:
        Subgroup fence-wait-blt:
                skip       -> PASS       (shard-snb)
Test kms_flip:
        Subgroup blt-wf_vblank-vs-modeset-interruptible:
                skip       -> PASS       (shard-snb) fdo#104218

fdo#102252 https://bugs.freedesktop.org/show_bug.cgi?id=102252
fdo#101623 https://bugs.freedesktop.org/show_bug.cgi?id=101623
fdo#103167 https://bugs.freedesktop.org/show_bug.cgi?id=103167
fdo#103540 https://bugs.freedesktop.org/show_bug.cgi?id=103540
fdo#104058 https://bugs.freedesktop.org/show_bug.cgi?id=104058
fdo#104600 https://bugs.freedesktop.org/show_bug.cgi?id=104600
fdo#104218 https://bugs.freedesktop.org/show_bug.cgi?id=104218

shard-hsw        total:2655 pass:1506 dwarn:1   dfail:0   fail:11  skip:1136 time:8859s
shard-snb        total:2713 pass:1309 dwarn:1   dfail:0   fail:12  skip:1391 time:7857s
Blacklisted hosts:
shard-apl        total:2713 pass:1686 dwarn:1   dfail:0   fail:24  skip:1001 time:13521s
shard-kbl        total:2713 pass:1809 dwarn:1   dfail:1   fail:24  skip:878 time:10629s

== Logs ==

For more details see: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_7657/shards.html
_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx