Received: by 2002:a05:6358:7058:b0:131:369:b2a3 with SMTP id 24csp9384668rwp; Thu, 20 Jul 2023 04:17:39 -0700 (PDT) X-Google-Smtp-Source: APBJJlHz7CwrGHwGXifhtBzOtlVjV2odRyz65/a2cBPsB8udmcEDGQOV/N+XupSkOEBdHuQlWl+t X-Received: by 2002:a05:6870:7a6:b0:1b3:8fed:c4a0 with SMTP id en38-20020a05687007a600b001b38fedc4a0mr1325321oab.1.1689851859022; Thu, 20 Jul 2023 04:17:39 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1689851858; cv=none; d=google.com; s=arc-20160816; b=mFYwux9VRSD3XMJD7RHq0ckxvSqIOLg6qnyO90P2wE6vFEI1mbTuYb17uKVd7oUiMx BhzM6+g9erjJcKVduAD+CKAKDPSgjOb7XPz8iL9oP1YcC7HL2clvPj2/cFHdOxlflFvb gGzCo2p9DB+/GoV08GJR7NwQO5pP1zlO3D82CrsEjZAx+6D75fNZ1+B80sTB2i0t94li IMIX+lTjrLNa9lvPpidjwYWUn34BY4/Tl3ebcS4tGlqCD7xnp997Djnp5oQk8Q47urcv b8GHz/3TMCs9JKT01voHHxwNzGHmj3Wx9h8VW27mA3bULURpkrQ6ykc/VH/Mbz5186Q+ qWJA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=WWFVGLYDsZhvm0vsfvSc3D0EOWSEQUvQuVgheW8pbhY=; fh=RpULKHJpnyX5C6fzrEf37eG1XMXKYQuF3Ud7bGV5lms=; b=cPjtnIluaQIh48ygRH7DN80RZ7qFnlb9Ripdfe4pUsRnmkPSr+pHURQNN0BZCYjkgR kHrIOJ4DwbJ4APxmbchPUH+yQzMkeL//WIVHT6pN1pzBxc5ny+81O2aCNtJBzID6UYD2 P2Y291EU7xbKJePKnLw+XZfosIZptHiRN8sK/Yy7/DFXBp4HNNEBzo5903IAsaTwyo8j in5fTXRPn11WmrQSOc5u0l41nQqpbptpD2d6SZ16cF6uQhfx8Vgvlp5uMsmxfEyedrHb UiTqJgRwzMf0P8EgDQ0DY2+fk374PnsOmMyKNM0g1ixkfrfEKvYlAJG4lFQMMb7mn1RJ b7rA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=QPXZJYsW; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id z6-20020a633306000000b00541710a9d44si630394pgz.114.2023.07.20.04.17.26; Thu, 20 Jul 2023 04:17:38 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=QPXZJYsW; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230010AbjGTLG6 (ORCPT + 99 others); Thu, 20 Jul 2023 07:06:58 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:52624 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229476AbjGTLG5 (ORCPT ); Thu, 20 Jul 2023 07:06:57 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 2EC32268F for ; Thu, 20 Jul 2023 04:06:56 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id BBC4061A22 for ; Thu, 20 Jul 2023 11:06:55 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id A048DC433C7; Thu, 20 Jul 2023 11:06:54 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1689851215; bh=nW6GXJXezOzmxKL/mUK7YWV/NMfVem88eLoJC7XaP08=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=QPXZJYsWPRAvaTWcfYGqmiW3vs3x0iPKKEk0GYNEYkOK9UkiAx7PPXWpWTOcy/s1A VXQ83P7k1kHTDazNqO/cqTcpQsFZ5WUScA4oWzS+8BxC24/9btrTtVrdHlVKZkkCDw 30A2Lc98eVOYbxzfYhGr0e1y9UrNQ+kvWc4tsaFQTGL/M9BYXKswJiqyHHbRGPv85N Tcr+qMlV8MGewzEAcxaQhdidO0xzio7+V+FCqc1nFPmrXUj6arfGHufFQlmI+F/LFs ynBTcXbBL5tcoUA1Y5hXqg2MmmPzi8yAyKB4EOZTyTzuUUzONhNDTOB7jdZNhE2UWd G402Q/7XNRXZw== Date: Thu, 20 Jul 2023 13:06:51 +0200 From: Maxime Ripard To: suijingfeng Cc: David Airlie , Daniel Vetter , Maarten Lankhorst , Thomas Zimmermann , Emma Anholt , linux-kernel@vger.kernel.org, dri-devel@lists.freedesktop.org Subject: Re: [09/11] drm/vc4: tests: pv-muxing: Switch to managed locking init Message-ID: References: <20230710-kms-kunit-actions-rework-v1-9-722c58d72c72@kernel.org> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha512; protocol="application/pgp-signature"; boundary="i6yioejuufk34fo2" Content-Disposition: inline In-Reply-To: X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF, RCVD_IN_DNSWL_BLOCKED,SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org --i6yioejuufk34fo2 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Tue, Jul 18, 2023 at 01:24:29AM +0800, suijingfeng wrote: > On 2023/7/10 15:47, Maxime Ripard wrote: > > The new helper to init the locking context allows to remove some > > boilerplate. > >=20 > > Signed-off-by: Maxime Ripard > > --- > > drivers/gpu/drm/vc4/tests/vc4_test_pv_muxing.c | 42 ++++++++++++-----= --------- > > 1 file changed, 19 insertions(+), 23 deletions(-) > >=20 > > diff --git a/drivers/gpu/drm/vc4/tests/vc4_test_pv_muxing.c b/drivers/g= pu/drm/vc4/tests/vc4_test_pv_muxing.c > > index 776a7b01608f..ff1deaed0cab 100644 > > --- a/drivers/gpu/drm/vc4/tests/vc4_test_pv_muxing.c > > +++ b/drivers/gpu/drm/vc4/tests/vc4_test_pv_muxing.c > > @@ -20,7 +20,6 @@ > > struct pv_muxing_priv { > > struct vc4_dev *vc4; > > - struct drm_modeset_acquire_ctx ctx; > > struct drm_atomic_state *state; > > }; > > @@ -725,6 +724,7 @@ static void drm_vc4_test_pv_muxing_invalid(struct k= unit *test) > > static int vc4_pv_muxing_test_init(struct kunit *test) > > { > > const struct pv_muxing_param *params =3D test->param_value; > > + struct drm_modeset_acquire_ctx *ctx; > > struct drm_atomic_state *state; > > struct pv_muxing_priv *priv; > > struct drm_device *drm; > > @@ -738,13 +738,14 @@ static int vc4_pv_muxing_test_init(struct kunit *= test) > > KUNIT_ASSERT_NOT_ERR_OR_NULL(test, vc4); > > priv->vc4 =3D vc4; > > - drm_modeset_acquire_init(&priv->ctx, 0); > > + ctx =3D drm_kunit_helper_acquire_ctx_alloc(test); >=20 > > + KUNIT_ASSERT_NOT_ERR_OR_NULL(test, ctx); >=20 > The pointer returned by drm_kunit_helper_acquire_ctx_alloc() function can= 't > be NULL, >=20 > if ctx is NULL, the current kthread will be terminated by the > KUNIT_ASSERT_NOT_NULL() in the drm_kunit_helper_acquire_ctx_alloc(). >=20 > so only a PTR_ERR is possible, right? >=20 > If so, probably invent a KUNIT_ASSERT_NOT_ERR() function to call is enoug= h. >=20 > I'm fine with this patch, but I feel the checking if the ctx is NULL is > redundant. I guess, but we're still reference that pointer later on, so making sure that it's a valid pointer still makes sense. Maxime --i6yioejuufk34fo2 Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iHUEABYKAB0WIQRcEzekXsqa64kGDp7j7w1vZxhRxQUCZLkVSwAKCRDj7w1vZxhR xa9aAQDZyXaMtBF9l/m6WbuHQ7xXPN4u13bFG6gaQKEYJBXObQEAvvZ9chBq2mOw +gey9Qa8fNru+HXpI0eQL4SLh5feZQo= =AI02 -----END PGP SIGNATURE----- --i6yioejuufk34fo2--