提交 2f6c5389 编写于 作者: T Thierry Reding 提交者: Daniel Vetter

drm: Prefer kmalloc_array() over kmalloc() with multiply

Fixes a couple of checkpatch warnings regarding the use of kmalloc()
with a multiplication. kmalloc_array() is the preferred API.
Signed-off-by: NThierry Reding <treding@nvidia.com>
Signed-off-by: NDaniel Vetter <daniel.vetter@ffwll.ch>
上级 bd3f0ff9
...@@ -1174,7 +1174,7 @@ int drm_universal_plane_init(struct drm_device *dev, struct drm_plane *plane, ...@@ -1174,7 +1174,7 @@ int drm_universal_plane_init(struct drm_device *dev, struct drm_plane *plane,
plane->base.properties = &plane->properties; plane->base.properties = &plane->properties;
plane->dev = dev; plane->dev = dev;
plane->funcs = funcs; plane->funcs = funcs;
plane->format_types = kmalloc(sizeof(uint32_t) * format_count, plane->format_types = kmalloc_array(format_count, sizeof(uint32_t),
GFP_KERNEL); GFP_KERNEL);
if (!plane->format_types) { if (!plane->format_types) {
DRM_DEBUG_KMS("out of memory when allocating plane\n"); DRM_DEBUG_KMS("out of memory when allocating plane\n");
...@@ -2705,7 +2705,7 @@ int drm_mode_setcrtc(struct drm_device *dev, void *data, ...@@ -2705,7 +2705,7 @@ int drm_mode_setcrtc(struct drm_device *dev, void *data,
goto out; goto out;
} }
connector_set = kmalloc(crtc_req->count_connectors * connector_set = kmalloc_array(crtc_req->count_connectors,
sizeof(struct drm_connector *), sizeof(struct drm_connector *),
GFP_KERNEL); GFP_KERNEL);
if (!connector_set) { if (!connector_set) {
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册