From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-1.0 required=3.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,SPF_PASS, URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 8AB9FC43381 for ; Mon, 1 Apr 2019 15:44:01 +0000 (UTC) Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 4233020651 for ; Mon, 1 Apr 2019 15:44:01 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="eooSaGvI" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 4233020651 Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=anholt.net Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-arm-kernel-bounces+infradead-linux-arm-kernel=archiver.kernel.org@lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender:Content-Type:Cc: List-Subscribe:List-Help:List-Post:List-Archive:List-Unsubscribe:List-Id: MIME-Version:Message-ID:Date:References:In-Reply-To:Subject:To:From:Reply-To: Content-Transfer-Encoding:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=YHz5Ag0ZbxQLH7Pdp0lhZMALLP+lwCzfdFlQRRSvPpk=; b=eooSaGvIrZFHiSyRrbf1rL4uc hUeHRZUlYDzFCgz7WQEBqwWSezq1R6sw7KoMrIAit55NDecin77+qMUie3GGZ5FH9Sp0vSMX1Zcy/ 6GCLS82qTNy4sJaME+NOSt66wkSzQdbCAcM6WrwrJOKO+fy9oQMWJGC/zBE6RBYi+FnK3BWcfS0CJ IAJIazEtW42dunh/UZoZ25+eChR5PbQggpLnvK8aYH7pucIWvpEFaigXG6mD2b731QUIjqFYq3kq5 XvvRC8RAvqt6c7zlFZ2XCihVRREcnDGoP7iZjTje6nwsJTNkN0/zQXA0jlfHpYhxwVhEuuPlDHxAk SePRpwB1w==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.90_1 #2 (Red Hat Linux)) id 1hAz6K-0001Fb-U2; Mon, 01 Apr 2019 15:43:56 +0000 Received: from anholt.net ([50.246.234.109]) by bombadil.infradead.org with esmtp (Exim 4.90_1 #2 (Red Hat Linux)) id 1hAz6H-0001Et-Ud for linux-arm-kernel@lists.infradead.org; Mon, 01 Apr 2019 15:43:55 +0000 Received: from localhost (localhost [127.0.0.1]) by anholt.net (Postfix) with ESMTP id 3F85B10A280A; Mon, 1 Apr 2019 08:43:50 -0700 (PDT) X-Virus-Scanned: Debian amavisd-new at anholt.net Received: from anholt.net ([127.0.0.1]) by localhost (kingsolver.anholt.net [127.0.0.1]) (amavisd-new, port 10024) with LMTP id o7B0OpqILtge; Mon, 1 Apr 2019 08:43:49 -0700 (PDT) Received: from eliezer.anholt.net (localhost [127.0.0.1]) by anholt.net (Postfix) with ESMTP id F361310A0220; Mon, 1 Apr 2019 08:43:48 -0700 (PDT) Received: by eliezer.anholt.net (Postfix, from userid 1000) id 76A912FE2F72; Mon, 1 Apr 2019 08:43:48 -0700 (PDT) From: Eric Anholt To: Chris Wilson , Daniel Vetter , Rob Herring Subject: Re: [PATCH v2 2/3] drm: Add a drm_gem_objects_lookup helper In-Reply-To: <155412649586.24691.809508732198367112@skylake-alporthouse-com> References: <20190401074730.12241-1-robh@kernel.org> <20190401074730.12241-3-robh@kernel.org> <155412649586.24691.809508732198367112@skylake-alporthouse-com> User-Agent: Notmuch/0.22.2+1~gb0bcfaa (http://notmuchmail.org) Emacs/25.2.2 (x86_64-pc-linux-gnu) Date: Mon, 01 Apr 2019 08:43:47 -0700 Message-ID: <8736n120jw.fsf@anholt.net> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20190401_084354_015877_6B2A2190 X-CRM114-Status: GOOD ( 12.98 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Neil Armstrong , Maxime Ripard , Sean Paul , Will Deacon , Linux Kernel Mailing List , dri-devel , David Airlie , "list@263.net:IOMMU DRIVERS , Joerg Roedel , " , Alyssa Rosenzweig , Robin Murphy , Linux ARM Content-Type: multipart/mixed; boundary="===============1303957891764946287==" Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+infradead-linux-arm-kernel=archiver.kernel.org@lists.infradead.org --===============1303957891764946287== Content-Type: multipart/signed; boundary="=-=-="; micalg=pgp-sha512; protocol="application/pgp-signature" --=-=-= Content-Type: text/plain Chris Wilson writes: > Quoting Daniel Vetter (2019-04-01 14:06:48) >> On Mon, Apr 1, 2019 at 9:47 AM Rob Herring wrote: >> > +{ >> > + int i, ret = 0; >> > + struct drm_gem_object *obj; >> > + >> > + spin_lock(&filp->table_lock); >> > + >> > + for (i = 0; i < count; i++) { >> > + /* Check if we currently have a reference on the object */ >> > + obj = idr_find(&filp->object_idr, handle[i]); >> > + if (!obj) { >> > + ret = -ENOENT; > > Unwind previous drm_gem_object_get(), the caller has no idea how many > were processed before the error. I had the same thought, but the pattern we have is that you're loading into a refcounted struct that will free the BOs when you're done, anyway. --=-=-= Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iQIzBAEBCgAdFiEE/JuuFDWp9/ZkuCBXtdYpNtH8nugFAlyiMbMACgkQtdYpNtH8 nujFuRAAtd7ggD7Y+nzWpAGHGpCEBgf6La2B4uHi5SYwMJ1ayMSjxnkx31DyQ4el ehc1zitZ8lNeJs3RkeIQTlBcLvVmCvkiKRftEIHihA+hbPl9Y8+sadcEbSln2kHT vjGZyEQ9anQjQIOSaiSmUMVO2MzbbjS9VNsRP87jHDiqu40WSA9R8lP0yFnbjTkJ 4Fc4wnoduR+Z+o5DxhknFRhBfivIswXI25LnB+gG/cCJ4i8N6QjoY/qbQnnQHcwK hbDTWkqeN2lyzZkTW/fvvksDRY+ODAj1J5kyQohhe9O3qtTRxawtHcRWqjPRDXfY LC4bKRjRk9184JJQxnwW8KqsuYsqciHDPjWY8U6ezoTrHQ2QnRguC4IiUSICLrhT Ova551wK9xbKIfhVd1M1NWx5QgOn7KWoy7Oiv+DMHGGN7+ohHzo5kABb3OLQA36o DRMTk0Ot3KsTFCskbHR0mkGTCEFjyC96R9VmkSToi1QCW8enDwe4jdskXcX5An8h 59dZvFgCn641x08E6mG1j2PkyuzezV7puE5CbJWlJWlaVRXP+QGngydTS29AaJip GOT2fIabzQ8fQ3eCmaD9Wtpx7xY8p6HAIwmk95fk/XjtTLs4iS9ZGc8+vM+ISdWv Qaw7BpiSXNPLGi3/C1rGpLTCaDVcEWafWJkEDf9puOnci7aSwjM= =jMdG -----END PGP SIGNATURE----- --=-=-=-- --===============1303957891764946287== Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Disposition: inline _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel --===============1303957891764946287==--