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 phobos.denx.de (phobos.denx.de [85.214.62.61]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 37A90C54EBC for ; Sun, 8 Jan 2023 02:57:17 +0000 (UTC) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 15520856FA; Sun, 8 Jan 2023 03:53:01 +0100 (CET) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=chromium.org Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de Authentication-Results: phobos.denx.de; dkim=pass (1024-bit key; unprotected) header.d=chromium.org header.i=@chromium.org header.b="ntHZa4xc"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 2DB9785627; Sun, 8 Jan 2023 03:52:31 +0100 (CET) Received: from mail-il1-x12b.google.com (mail-il1-x12b.google.com [IPv6:2607:f8b0:4864:20::12b]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits)) (No client certificate requested) by phobos.denx.de (Postfix) with ESMTPS id C373E85640 for ; Sun, 8 Jan 2023 03:51:16 +0100 (CET) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=chromium.org Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=sjg@chromium.org Received: by mail-il1-x12b.google.com with SMTP id u8so3271286ilq.13 for ; Sat, 07 Jan 2023 18:51:16 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=+WtJPsg+ETzdqg1QnQOQVgXLqjV4VQ0WwABtMjQfLvs=; b=ntHZa4xcEYuhsgSrnsuyrG8pQjUc8tlqmMKlwuBehJ66ooe8pCVGWHqIKBmP4tOeVt yR6wTyuocy5I8vft4VurWhxS0pwhKQMFK/gXBXBbgX5wbCU1bENdFwV1Zh7arJnlmlSK PrCp+uvk4BLwgEhAyPTqWd0MazZZcoIPXVPq0= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=+WtJPsg+ETzdqg1QnQOQVgXLqjV4VQ0WwABtMjQfLvs=; b=zpG/D+LApDKQtkrue0fpZV3ThKk6y1krlLHD735F5cgqd8LZqR1GP/6mv4dTZcQ3np sfqS6ZFsbTRvZDZ0Rx0Xe3eSaDHPEaUcbTQgrw9r1QyGhaNfM3NrN6NMnTxZD8/0pjy7 Cwput7XqhKGi+FzDXrR7PyAqV/BN+rA73BEHjQeboM1MebonXjz4omEi7DuwahciuL2p 9QuICkZUncQpi/BVesjeTLXo1rb57VFexVHw66xKf7ONTwqSE4BWnQtben092kSilcte hkCCwkgkntRR/J1uxgtROJtFdaympHu0LPPTmBG0o1jx9Owuaxd3DmPSgTM7+yIJ6oWV zBEw== X-Gm-Message-State: AFqh2koylGe1o5nhJiSOSljTmBmeKloFI7/0WarOT3T82bNHTsfqclXL f1cxDZXuLbm01yobVy/UK2zmm4QyFSENTgVj X-Google-Smtp-Source: AMrXdXvlugCM7sZihXlc4Ov1YmK68iSa9BZHToUKvORVK5JJGg8untVy/aiUTSN7oSphq1q6a0d36w== X-Received: by 2002:a05:6e02:1d9a:b0:30c:5f8d:887a with SMTP id h26-20020a056e021d9a00b0030c5f8d887amr16551073ila.2.1673146276316; Sat, 07 Jan 2023 18:51:16 -0800 (PST) Received: from sjg1.roam.corp.google.com (c-71-56-217-229.hsd1.co.comcast.net. [71.56.217.229]) by smtp.gmail.com with ESMTPSA id c17-20020a92bd11000000b00302a00aaefasm1622174ile.26.2023.01.07.18.51.15 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 07 Jan 2023 18:51:16 -0800 (PST) From: Simon Glass To: U-Boot Mailing List Cc: U-Boot Custodians , Simon Glass , Marek Vasut , Pavel Herrmann Subject: [PATCH v2 26/71] dm: usb: Mark the device name as alloced when binding Date: Sat, 7 Jan 2023 19:50:02 -0700 Message-Id: <20230108025047.522240-27-sjg@chromium.org> X-Mailer: git-send-email 2.39.0.314.g84b9a713c41-goog In-Reply-To: <20230108025047.522240-1-sjg@chromium.org> References: <20230108025047.522240-1-sjg@chromium.org> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.39 Precedence: list List-Id: U-Boot discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: u-boot-bounces@lists.denx.de Sender: "U-Boot" X-Virus-Scanned: clamav-milter 0.103.6 at phobos.denx.de X-Virus-Status: Clean Since usb_find_and_bind_driver() allocates the device name it should tell driver about that, to avoid memory leaks. Fix this. Signed-off-by: Simon Glass --- (no changes since v1) drivers/usb/host/usb-uclass.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/drivers/usb/host/usb-uclass.c b/drivers/usb/host/usb-uclass.c index 956e2a4e8e4..04256eff879 100644 --- a/drivers/usb/host/usb-uclass.c +++ b/drivers/usb/host/usb-uclass.c @@ -559,6 +559,8 @@ static int usb_find_and_bind_driver(struct udevice *parent, if (!str) return -ENOMEM; ret = device_bind_driver(parent, "usb_dev_generic_drv", str, devp); + if (!ret) + device_set_name_alloced(*devp); error: debug("%s: No match found: %d\n", __func__, ret); -- 2.39.0.314.g84b9a713c41-goog