From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 3D3322E62AD for ; Thu, 16 Oct 2025 09:25:56 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1760606757; cv=none; b=DIGEA5AwOOzc7nalc4DBK3zc7pSBaKA7h/96535xJtHOENYOGwTGmE5OUavkcXL/vNuq/4oRB8+e82NnBjyz6FZVSex+gi0SM3S67Z4nZRfj7/lZ56BFOX+1HF/dm/8gLf0QbzaX4SfXlzBXtqdznhvcBrZd9eFtT+v1jdsX4V0= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1760606757; c=relaxed/simple; bh=UWDHKaZph/3siimqJAuU4BLMKtsRnCOpDKeYR4IPgtE=; h=Subject:To:Cc:From:Date:Message-ID:MIME-Version:Content-Type; b=pxebA7IdoXdMuWYZzuIThX+D+d3rnpdwgF8SGmHf7x0PZGRF6mx5GdtIUmntjLJUOQ8UaMkI5jNm3K3n+Rs+Jkss824V+eGvKFIujNEps2I4lOVYYzpxaZBG8ofz100EkIWYHfrcUZc2Xm9IjYSbhkige5nPvpBy7q7tlEYTZQw= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b=oicjwKuC; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b="oicjwKuC" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 6A90EC4CEF1; Thu, 16 Oct 2025 09:25:56 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1760606756; bh=UWDHKaZph/3siimqJAuU4BLMKtsRnCOpDKeYR4IPgtE=; h=Subject:To:Cc:From:Date:From; b=oicjwKuCm/abdgGI63NNy9+I/Oyr3swyhWf79iT4onrg7wNxX1H+4DfK4f2YJR/E7 fUV5tum/FxInGM1SceAcAY4KVLOAXH/UjZR22VTvE2HGPebWsFHT/goSyF/tVxbSoH y87zzFcjM8JJxTdQWdrvdu/DHmMDyy3o+dyi3iSI= Subject: FAILED: patch "[PATCH] usb: gadget: Introduce free_usb_request helper" failed to apply to 6.12-stable tree To: khtsai@google.com,gregkh@linuxfoundation.org Cc: From: Date: Thu, 16 Oct 2025 11:25:43 +0200 Message-ID: <2025101643-efficient-commotion-51f2@gregkh> Precedence: bulk X-Mailing-List: stable@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=ANSI_X3.4-1968 Content-Transfer-Encoding: 8bit The patch below does not apply to the 6.12-stable tree. If someone wants it applied there, or to any other stable or longterm tree, then please email the backport, including the original git commit id to . To reproduce the conflict and resubmit, you may use the following commands: git fetch https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/ linux-6.12.y git checkout FETCH_HEAD git cherry-pick -x 201c53c687f2b55a7cc6d9f4000af4797860174b # git commit -s git send-email --to '' --in-reply-to '2025101643-efficient-commotion-51f2@gregkh' --subject-prefix 'PATCH 6.12.y' HEAD^.. Possible dependencies: thanks, greg k-h ------------------ original commit in Linus's tree ------------------ >From 201c53c687f2b55a7cc6d9f4000af4797860174b Mon Sep 17 00:00:00 2001 From: Kuen-Han Tsai Date: Tue, 16 Sep 2025 16:21:33 +0800 Subject: [PATCH] usb: gadget: Introduce free_usb_request helper Introduce the free_usb_request() function that frees both the request's buffer and the request itself. This function serves as the cleanup callback for DEFINE_FREE() to enable automatic, scope-based cleanup for usb_request pointers. Signed-off-by: Kuen-Han Tsai Link: https://lore.kernel.org/r/20250916-ready-v1-2-4997bf277548@google.com Signed-off-by: Greg Kroah-Hartman Link: https://lore.kernel.org/r/20250916-ready-v1-2-4997bf277548@google.com diff --git a/include/linux/usb/gadget.h b/include/linux/usb/gadget.h index 0f2079476088..3aaf19e77558 100644 --- a/include/linux/usb/gadget.h +++ b/include/linux/usb/gadget.h @@ -15,6 +15,7 @@ #ifndef __LINUX_USB_GADGET_H #define __LINUX_USB_GADGET_H +#include #include #include #include @@ -293,6 +294,28 @@ static inline void usb_ep_fifo_flush(struct usb_ep *ep) /*-------------------------------------------------------------------------*/ +/** + * free_usb_request - frees a usb_request object and its buffer + * @req: the request being freed + * + * This helper function frees both the request's buffer and the request object + * itself by calling usb_ep_free_request(). Its signature is designed to be used + * with DEFINE_FREE() to enable automatic, scope-based cleanup for usb_request + * pointers. + */ +static inline void free_usb_request(struct usb_request *req) +{ + if (!req) + return; + + kfree(req->buf); + usb_ep_free_request(req->ep, req); +} + +DEFINE_FREE(free_usb_request, struct usb_request *, free_usb_request(_T)) + +/*-------------------------------------------------------------------------*/ + struct usb_dcd_config_params { __u8 bU1devExitLat; /* U1 Device exit Latency */ #define USB_DEFAULT_U1_DEV_EXIT_LAT 0x01 /* Less then 1 microsec */