From nobody Mon Sep 30 05:08:21 2024 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4XH8Gt0fCcz5XltQ; Mon, 30 Sep 2024 05:08:22 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R11" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4XH8Gs59r8z4XK3; Mon, 30 Sep 2024 05:08:21 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1727672901; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=b75OCzZwkyM+0RMWyyKe3MYcv2e0q/TDlSkzqrNvh0g=; b=ha6udomEdJxbdpp8ed0HdqmNxI+YmIHCn2sLsJqEULhcG2BULeouSVcodRuH1sOVSrlJUx nRh3XZ3ii9ABf50w38yAKDM7SYjPKjEljanaSnBF8rEDbcfzP/lOlfcwQGoGFkmrJtkQk1 3gM2eRhw3iUPSc0BE/qxUyovh33F2XfLblDzC0ACpq5d0mAooJxNudUs0bjbe+ct42hyJT GuxKS87l+jdrvzzXJmV5JF6t2XJoK9Zv3R49tWmB1MnUR6kun286Wi+z4mpXOMuTsphEsC qFs5mZVlRNaycG1MZzdiEtqSmcoCIvJamoYBidFDEZdPGAXG6FqW3pZyloiYTg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1727672901; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=b75OCzZwkyM+0RMWyyKe3MYcv2e0q/TDlSkzqrNvh0g=; b=Xd2cfWUAXdvdJ2dQuQJyR1gWALACyocXZzo3F1n2yk5mQ0c5KcyEjahHDIzRgbsEo9TeUU km3ED9w73y5hpoDYjF4a7m94EPVOEaoOpL0uIxtgyTlXeWJgOE8deK7kLULzw9rukDA6N1 9TZeLePeWs7CUQbpA/aHqKrYxzbUWiCnGCdR0uXPBnZTve6h8lNXDmWLCGGz2kCCYL7t/j CncN+so6oJDhTOoXZETVbYvVwDDPJ+Oeih5Xh1l4zzJ41y1HSrou6T6U1GmIT2Zfj6zQU3 HOmb3jPLVgo0Gbq097ZszC2baV54zkSjI3cW4BCUM+bzyj3+WkwKqf1G8Mp5ew== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1727672901; a=rsa-sha256; cv=none; b=pEpkcADcRqYTflv1mfrvzwpjb7o/I+EyuL7XDOl2vsS4r0UT+SLV5hRBk6TJ0ygBCaCn6E br/HVpiV7h4aA0RFxYfWqHczZr1MgTy+cEJ6FVOCklkuYkRIMoa02ZnVvQOdkK16TmHOqP ZcpoTQF9L3XSRz//jL/K06MBGH4FV1++0IKm2SdbAh2ZzfgwNQc3BKAKXtQD5si1INgWJ8 D+tB+uzMHj+CcNzddv96v+kd0WZg+3iumoEZ20gJDEfqWSOfAypIM2bpimIQHEYrg370SG LRxwpKZegbQGh/UuLsakHNP1IM4lncV0xxJr75P+ROWLMUfka1hhylVFHscSFQ== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4XH8Gs4lTszg87; Mon, 30 Sep 2024 05:08:21 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.18.1/8.18.1) with ESMTP id 48U58Lxn024969; Mon, 30 Sep 2024 05:08:21 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 48U58Lhk024966; Mon, 30 Sep 2024 05:08:21 GMT (envelope-from git) Date: Mon, 30 Sep 2024 05:08:21 GMT Message-Id: <202409300508.48U58Lhk024966@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Zhenlei Huang Subject: git: 73e399c157a8 - stable/13 - drm2: Stop checking for failures from malloc(M_WAITOK) List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-src-all@freebsd.org Sender: owner-dev-commits-src-all@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: zlei X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: 73e399c157a82dbe7d1ffd7e0346ead7e2167952 Auto-Submitted: auto-generated The branch stable/13 has been updated by zlei: URL: https://cgit.FreeBSD.org/src/commit/?id=73e399c157a82dbe7d1ffd7e0346ead7e2167952 commit 73e399c157a82dbe7d1ffd7e0346ead7e2167952 Author: Zhenlei Huang AuthorDate: 2024-09-03 10:25:26 +0000 Commit: Zhenlei Huang CommitDate: 2024-09-30 05:05:34 +0000 drm2: Stop checking for failures from malloc(M_WAITOK) MFC after: 1 week Differential Revision: https://reviews.freebsd.org/D45852 (cherry picked from commit 6dbf3aca4f5c4f7287f186360c2391f2adfea8d6) (cherry picked from commit 95532d15a12c9cbf7c5e62e912de90919af7db24) --- sys/dev/drm2/drm_buffer.c | 30 ----------------------------- sys/dev/drm2/drm_crtc.c | 45 +------------------------------------------ sys/dev/drm2/ttm/ttm_object.c | 5 ----- 3 files changed, 1 insertion(+), 79 deletions(-) diff --git a/sys/dev/drm2/drm_buffer.c b/sys/dev/drm2/drm_buffer.c index 8a674397262e..8069f2c8c4c6 100644 --- a/sys/dev/drm2/drm_buffer.c +++ b/sys/dev/drm2/drm_buffer.c @@ -50,45 +50,15 @@ int drm_buffer_alloc(struct drm_buffer **buf, int size) * variable sized */ *buf = malloc(sizeof(struct drm_buffer) + nr_pages*sizeof(char *), DRM_MEM_DRIVER, M_ZERO | M_WAITOK); - - if (*buf == NULL) { - DRM_ERROR("Failed to allocate drm buffer object to hold" - " %d bytes in %d pages.\n", - size, nr_pages); - return -ENOMEM; - } - (*buf)->size = size; for (idx = 0; idx < nr_pages; ++idx) { - (*buf)->data[idx] = malloc(min(PAGE_SIZE, size - idx * PAGE_SIZE), DRM_MEM_DRIVER, M_WAITOK); - - - if ((*buf)->data[idx] == NULL) { - DRM_ERROR("Failed to allocate %dth page for drm" - " buffer with %d bytes and %d pages.\n", - idx + 1, size, nr_pages); - goto error_out; - } - } return 0; - -error_out: - - /* Only last element can be null pointer so check for it first. */ - if ((*buf)->data[idx]) - free((*buf)->data[idx], DRM_MEM_DRIVER); - - for (--idx; idx >= 0; --idx) - free((*buf)->data[idx], DRM_MEM_DRIVER); - - free(*buf, DRM_MEM_DRIVER); - return -ENOMEM; } EXPORT_SYMBOL(drm_buffer_alloc); diff --git a/sys/dev/drm2/drm_crtc.c b/sys/dev/drm2/drm_crtc.c index b9415082e7a1..a163c7455773 100644 --- a/sys/dev/drm2/drm_crtc.c +++ b/sys/dev/drm2/drm_crtc.c @@ -662,13 +662,6 @@ int drm_plane_init(struct drm_device *dev, struct drm_plane *plane, plane->funcs = funcs; plane->format_types = malloc(sizeof(uint32_t) * format_count, DRM_MEM_KMS, M_WAITOK); - if (!plane->format_types) { - DRM_DEBUG_KMS("out of memory when allocating plane\n"); - drm_mode_object_put(dev, &plane->base); - ret = -ENOMEM; - goto out; - } - memcpy(plane->format_types, formats, format_count * sizeof(uint32_t)); plane->format_count = format_count; plane->possible_crtcs = possible_crtcs; @@ -725,8 +718,6 @@ struct drm_display_mode *drm_mode_create(struct drm_device *dev) nmode = malloc(sizeof(struct drm_display_mode), DRM_MEM_KMS, M_WAITOK | M_ZERO); - if (!nmode) - return NULL; if (drm_mode_object_get(dev, &nmode->base, DRM_MODE_OBJECT_MODE)) { free(nmode, DRM_MEM_KMS); @@ -1009,9 +1000,6 @@ int drm_mode_group_init(struct drm_device *dev, struct drm_mode_group *group) group->id_list = malloc(total_objects * sizeof(uint32_t), DRM_MEM_KMS, M_WAITOK | M_ZERO); - if (!group->id_list) - return -ENOMEM; - group->num_crtcs = 0; group->num_connectors = 0; group->num_encoders = 0; @@ -1997,10 +1985,6 @@ int drm_mode_setcrtc(struct drm_device *dev, void *data, connector_set = malloc(crtc_req->count_connectors * sizeof(struct drm_connector *), DRM_MEM_KMS, M_WAITOK); - if (!connector_set) { - ret = -ENOMEM; - goto out; - } for (i = 0; i < crtc_req->count_connectors; i++) { set_connectors_ptr = (uint32_t __user *)(unsigned long)crtc_req->set_connectors_ptr; @@ -2522,11 +2506,6 @@ int drm_mode_dirtyfb_ioctl(struct drm_device *dev, } clips = malloc(num_clips * sizeof(*clips), DRM_MEM_KMS, M_WAITOK | M_ZERO); - if (!clips) { - ret = -ENOMEM; - goto out_err1; - } - ret = copy_from_user(clips, clips_ptr, num_clips * sizeof(*clips)); if (ret) { @@ -2773,15 +2752,10 @@ struct drm_property *drm_property_create(struct drm_device *dev, int flags, property = malloc(sizeof(struct drm_property), DRM_MEM_KMS, M_WAITOK | M_ZERO); - if (!property) - return NULL; - if (num_values) { + if (num_values) property->values = malloc(sizeof(uint64_t)*num_values, DRM_MEM_KMS, M_WAITOK | M_ZERO); - if (!property->values) - goto fail; - } ret = drm_mode_object_get(dev, &property->base, DRM_MODE_OBJECT_PROPERTY); if (ret) @@ -2907,9 +2881,6 @@ int drm_property_add_enum(struct drm_property *property, int index, prop_enum = malloc(sizeof(struct drm_property_enum), DRM_MEM_KMS, M_WAITOK | M_ZERO); - if (!prop_enum) - return -ENOMEM; - strncpy(prop_enum->name, name, DRM_PROP_NAME_LEN); prop_enum->name[DRM_PROP_NAME_LEN-1] = '\0'; prop_enum->value = value; @@ -3103,9 +3074,6 @@ static struct drm_property_blob *drm_property_create_blob(struct drm_device *dev blob = malloc(sizeof(struct drm_property_blob)+length, DRM_MEM_KMS, M_WAITOK | M_ZERO); - if (!blob) - return NULL; - ret = drm_mode_object_get(dev, &blob->base, DRM_MODE_OBJECT_BLOB); if (ret) { free(blob, DRM_MEM_KMS); @@ -3433,10 +3401,6 @@ int drm_mode_crtc_set_gamma_size(struct drm_crtc *crtc, crtc->gamma_store = malloc(gamma_size * sizeof(uint16_t) * 3, DRM_MEM_KMS, M_WAITOK | M_ZERO); - if (!crtc->gamma_store) { - crtc->gamma_size = 0; - return -ENOMEM; - } return 0; } @@ -3631,13 +3595,6 @@ int drm_mode_page_flip_ioctl(struct drm_device *dev, mtx_unlock(&dev->event_lock); e = malloc(sizeof *e, DRM_MEM_KMS, M_WAITOK | M_ZERO); - if (e == NULL) { - mtx_lock(&dev->event_lock); - file_priv->event_space += sizeof e->event; - mtx_unlock(&dev->event_lock); - goto out; - } - e->event.base.type = DRM_EVENT_FLIP_COMPLETE; e->event.base.length = sizeof e->event; e->event.user_data = page_flip->user_data; diff --git a/sys/dev/drm2/ttm/ttm_object.c b/sys/dev/drm2/ttm/ttm_object.c index 8c373618d7ac..31af15cf4c56 100644 --- a/sys/dev/drm2/ttm/ttm_object.c +++ b/sys/dev/drm2/ttm/ttm_object.c @@ -282,11 +282,6 @@ int ttm_ref_object_add(struct ttm_object_file *tfile, if (unlikely(ret != 0)) return ret; ref = malloc(sizeof(*ref), M_TTM_OBJ_REF, M_WAITOK); - if (unlikely(ref == NULL)) { - ttm_mem_global_free(mem_glob, sizeof(*ref)); - return -ENOMEM; - } - ref->hash.key = base->hash.key; ref->obj = base; ref->tfile = tfile;