From nobody Sat Apr 11 04:01:58 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 59383C32773 for ; Tue, 16 Aug 2022 15:39:05 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S236264AbiHPPjD (ORCPT ); Tue, 16 Aug 2022 11:39:03 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:50972 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236140AbiHPPiG (ORCPT ); Tue, 16 Aug 2022 11:38:06 -0400 Received: from smtp-out2.suse.de (smtp-out2.suse.de [195.135.220.29]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 3966885F80 for ; Tue, 16 Aug 2022 08:37:05 -0700 (PDT) Received: from imap2.suse-dmz.suse.de (imap2.suse-dmz.suse.de [192.168.254.74]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-521) server-digest SHA512) (No client certificate requested) by smtp-out2.suse.de (Postfix) with ESMTPS id CD4F81FEA2; Tue, 16 Aug 2022 15:37:03 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1660664223; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=7Hy2VW6BD3DgqN9i/mj4PIZCUAJudVB4+Gl1qLgYS5U=; b=F4xOkqUJVLYGHPUrWIe+iJKlD0NxY2J2md5Eh+5m4TCnZlJkiPj2wiMj/UqA/yV0r3xZjd bvHzrbrIwahJIdLL9/H6QD7pNVv0aZSmFyWQZAufxQlY0b0YcEBKl9jDj07LRixbwpAhsT rXCxOCXgxZEeboh4PKAKDxrnX+luZBI= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1660664223; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=7Hy2VW6BD3DgqN9i/mj4PIZCUAJudVB4+Gl1qLgYS5U=; b=m99cEjg/NX+Q6fXevBbBknH/OF1wVrj1u+lkW8dJnfLKaRZDdfEQ6OJ+DyVjN8UAKvVK+c yZ2TkJrdJAMDA/Bw== Received: from imap2.suse-dmz.suse.de (imap2.suse-dmz.suse.de [192.168.254.74]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-521) server-digest SHA512) (No client certificate requested) by imap2.suse-dmz.suse.de (Postfix) with ESMTPS id B06D6139B7; Tue, 16 Aug 2022 15:37:03 +0000 (UTC) Received: from dovecot-director2.suse.de ([192.168.254.65]) by imap2.suse-dmz.suse.de with ESMTPSA id wHV3Kp+5+2LKJAAAMHmgww (envelope-from ); Tue, 16 Aug 2022 15:37:03 +0000 From: Takashi Iwai To: Thomas Zimmermann Cc: dri-devel@lists.freedesktop.org, linux-kernel@vger.kernel.org Subject: [PATCH 11/12] drm/udl: Don't re-initialize stuff at retrying the URB list allocation Date: Tue, 16 Aug 2022 17:36:54 +0200 Message-Id: <20220816153655.27526-12-tiwai@suse.de> X-Mailer: git-send-email 2.35.3 In-Reply-To: <20220816153655.27526-1-tiwai@suse.de> References: <20220816153655.27526-1-tiwai@suse.de> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" udl_alloc_urb_list() retires the allocation if there is no enough room left, and it reinitializes the stuff unnecessarily such as the linked list head and the waitqueue, which could be harmful. Those should be outside the retry loop. Signed-off-by: Takashi Iwai Acked-by: Thomas Zimmermann --- drivers/gpu/drm/udl/udl_main.c | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/drivers/gpu/drm/udl/udl_main.c b/drivers/gpu/drm/udl/udl_main.c index 19dc8317e843..c1f4b6199949 100644 --- a/drivers/gpu/drm/udl/udl_main.c +++ b/drivers/gpu/drm/udl/udl_main.c @@ -187,15 +187,14 @@ static int udl_alloc_urb_list(struct drm_device *dev,= int count, size_t size) struct usb_device *udev =3D udl_to_usb_device(udl); =20 spin_lock_init(&udl->urbs.lock); - -retry: - udl->urbs.size =3D size; INIT_LIST_HEAD(&udl->urbs.list); - init_waitqueue_head(&udl->urbs.sleep); udl->urbs.count =3D 0; udl->urbs.available =3D 0; =20 +retry: + udl->urbs.size =3D size; + while (udl->urbs.count * size < wanted_size) { unode =3D kzalloc(sizeof(struct urb_node), GFP_KERNEL); if (!unode) --=20 2.35.3