Received: by 2002:a25:ab43:0:0:0:0:0 with SMTP id u61csp523297ybi; Wed, 19 Jun 2019 03:36:14 -0700 (PDT) X-Google-Smtp-Source: APXvYqy5mtfuVNAAf/9986WgJvr1iVezClitou5mukirdl8FRmJsW0WBaylfnH3Q7WTvHE+ucC85 X-Received: by 2002:a17:902:9a84:: with SMTP id w4mr16751109plp.160.1560940574608; Wed, 19 Jun 2019 03:36:14 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1560940574; cv=none; d=google.com; s=arc-20160816; b=ww8dx+I8sgbsb3v/qzCsnzfkc1VYjJWvfjE30BMsc5LHypKLDFPMgb6FqExs4KGl80 l+WtfZCLNEDB6rPi5GzNSgdIDeSZnT6jvM3KGzd+pN8SQKfAMsFFUqk8udlCflqg47Nq mrZoKR1sny63MbKFbFuXkizgJxaIGxWvHewvRHDVcv5PqmEC+53pJoMllv3XvLocBKXR Q4QQKrSJz7iGRsb0CBj94lYdujM5AG2WhN9FH+NM12Ryh7vAtgPo2+qHDLjCCJ1Fckop kUq1IytX87x0PqT4WtU1ibX13wSf3hq/GM5o/zYPrutN4fT0w9qQNiGejWCXcdgq5t6Q Rguw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date:dkim-signature; bh=urGhGMBj9Gj+93Uz4bCVBFsm8sW6q9N7nifD7I3Dmm0=; b=Dg2BYGQRNJPNjX4+Gpdst8oSRz05wsO9RAXPIhrNGDvOJOp6GUKYOGHLYnU6+SoeGx EousZ5huO0pig9X/twKpR2EW6ZMymMuaU3Q8UarrG6TU2qR9SgwVnHX2OMCySlthRdMx q//l6K1h7LGa3Qml+zc98JvWvnE0QbOKue3NWz+PKI9Gws/KX/TuFchqIyawyuqp6yBS iuF2v+bnKXx1FloE7Ij16wiboEurR1CIdbVnQR00FIiQQLtGBEXT4vJWS9mKC0MxvR/3 HgXmLXhAfq+7c8b3KSeUlZJsMymjImgXo9xQGWPp5OYHIpBOMq5gRyKhNr8A9TX35Ioe TsMw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=Me285Eft; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id a22si2722424pgb.292.2019.06.19.03.35.57; Wed, 19 Jun 2019 03:36:14 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=Me285Eft; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727198AbfFSKeU (ORCPT + 99 others); Wed, 19 Jun 2019 06:34:20 -0400 Received: from mail-wm1-f65.google.com ([209.85.128.65]:51735 "EHLO mail-wm1-f65.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726826AbfFSKeT (ORCPT ); Wed, 19 Jun 2019 06:34:19 -0400 Received: by mail-wm1-f65.google.com with SMTP id 207so1171968wma.1 for ; Wed, 19 Jun 2019 03:34:17 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to:user-agent; bh=urGhGMBj9Gj+93Uz4bCVBFsm8sW6q9N7nifD7I3Dmm0=; b=Me285EftGAvkCIm9KR5xzgD/NL8izuvygR9J344xkydeliRaRPW5ey628RjJ9Mou79 LRJXCQjIuWJqhr/4KPcqV+ZZpgVZ0/ELnk0cchhFVf6V9uOdGdr16KW0EhYSuSLVZ3jL ZRPYdouYLdWf+/VQReZpSzJJ3dWE/W1hyzpsxY5j/M9i1NqzGEvDjICgsyhCkPul+QV3 hM1Y7gnHrBQV7S3v5ibr7kqQm8YsXvPnOwodmB0P7yUzHmOkHBnQOsst4iWGPu1/H2J7 deHamS/6KyEiSgtA+ZaorzjLg+TeKkoJ3v9NZHOZ8szBo6X1aZyMt7+xBk55Oufo7lI3 Hkiw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to:user-agent; bh=urGhGMBj9Gj+93Uz4bCVBFsm8sW6q9N7nifD7I3Dmm0=; b=ac2K1HFweZ49glHmhAwAL9OdTaSoZspwdSDnY/hgFjJ81X/w+svj5WBOWRYS4e4env nsQku3qwMscuaDGtGvVqYK23l08UFMahksvrHIwIE1LQkYPzYFl6hKxhNh+C+NmqqD+H kKMlMHE6O/UpCOvtACp5nXyCtFxt8xNjmPHf8X4rNZdl28pn6dQVBoLzzBWdeTfYv+Xz JxsSH3yUotdnwuWT++K34YmFwRVVK8FRkGWzU4Lr8zDUGe+E7VHKGMkxIWa1Do9arGS7 awIIqsQexN3PwhcUgUqXLXL9SoXLiNfk3mygTJR8qRX7Y/p8PSxrfhLEk1OnhlyLrrYY DuQQ== X-Gm-Message-State: APjAAAURmA1Z7+DqTCm6VBn5xygLcz6QWBTbb1dFzT8s2qEcZ4qh1juT f/5tZHHjwHs0vz0H1ocGNYgtzqhM X-Received: by 2002:a1c:a186:: with SMTP id k128mr7944693wme.125.1560940457198; Wed, 19 Jun 2019 03:34:17 -0700 (PDT) Received: from arch-x1c3 ([2a00:5f00:102:0:9665:9cff:feee:aa4d]) by smtp.gmail.com with ESMTPSA id w67sm1417860wma.24.2019.06.19.03.34.16 (version=TLS1_3 cipher=AEAD-AES256-GCM-SHA384 bits=256/256); Wed, 19 Jun 2019 03:34:16 -0700 (PDT) Date: Wed, 19 Jun 2019 11:32:12 +0100 From: Emil Velikov To: Gerd Hoffmann Cc: dri-devel@lists.freedesktop.org, Maxime Ripard , open list , David Airlie , Sean Paul Subject: Re: [PATCH v3 01/12] drm: add gem array helpers Message-ID: <20190619103212.GA1896@arch-x1c3> References: <20190619090420.6667-1-kraxel@redhat.com> <20190619090420.6667-2-kraxel@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20190619090420.6667-2-kraxel@redhat.com> User-Agent: Mutt/1.11.4 (2019-03-13) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi Gerd, On 2019/06/19, Gerd Hoffmann wrote: > +/** > + * drm_gem_array_from_handles -- lookup an array of gem handles. > + * > + * @drm_file: drm file-private structure to use for the handle look up > + * @handles: the array of handles to lookup. > + * @nents: the numer of handles. > + * > + * Returns: An array of gem objects on success, NULL on failure. > + */ > +struct drm_gem_object_array* > +drm_gem_array_from_handles(struct drm_file *drm_file, u32 *handles, u32 nents) > +{ > + struct drm_gem_object_array *objs; > + u32 i; > + > + objs = drm_gem_array_alloc(nents); > + if (!objs) > + return NULL; > + > + for (i = 0; i < nents; i++) { > + objs->objs[i] = drm_gem_object_lookup(drm_file, handles[i]); > + if (!objs->objs[i]) { Missing object put for the 0..i-1 handles. Personally I would: objs->nents = i; drm_gem_array_put_free(objs); return NULL; > + drm_gem_array_put_free(objs); > + return NULL; > + } > + } > + return objs; > +} Missing EXPORT_SYMBOL? > + > +/** > + * drm_gem_array_put_free -- put gem objects and free array. > + * > + * @objs: the gem object array. > + */ > +void drm_gem_array_put_free(struct drm_gem_object_array *objs) > +{ > + u32 i; > + > + for (i = 0; i < objs->nents; i++) { > + if (!objs->objs[i]) > + continue; > + drm_gem_object_put_unlocked(objs->objs[i]); > + } > + drm_gem_array_free(objs); > +} Ditto? HTH Emil