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 E771FC352A1 for ; Wed, 7 Dec 2022 08:59:48 +0000 (UTC) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 4E201855F2; Wed, 7 Dec 2022 09:55:47 +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="kMGIR8Nd"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id ABB6185613; Wed, 7 Dec 2022 09:55:27 +0100 (CET) Received: from mail-pg1-x533.google.com (mail-pg1-x533.google.com [IPv6:2607:f8b0:4864:20::533]) (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 C6CB88560B for ; Wed, 7 Dec 2022 09:55:23 +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-pg1-x533.google.com with SMTP id w37so15682833pga.5 for ; Wed, 07 Dec 2022 00:55:23 -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=qZsbM0NxTF48N9RWcF7y6a8mgKso7Veqrwt0M9t5UXs=; b=kMGIR8NdXJKfyVycm9/clc68N8Ute/D+c8BKy2dbumI0uea91dQyPDoDudm9k98YkO zd7U6lHvH8ioVsuRAx29GPcJDTKi3z1eC/BjQavO+0vAv4ol/Rxf/P7JZYvmZ7RveGZU gLm8fnunmcZsUkx7GiPID21jsE7AnABwRndJM= 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=qZsbM0NxTF48N9RWcF7y6a8mgKso7Veqrwt0M9t5UXs=; b=B2bSlUxECCSQXayVfY9Q6xFbnvJ7ZsBzne1NG0g+lnhO6t/DTgpyTC2rXCmA1qFD0M mOLtsO6+1u74GhALp3ojlBU3Z0q0B2IRTQZbOdwoQ3y7GL+kNfuNYNRIMhsrYb9MJgTf 0AwXZscXMF23Sa0QVadQ9QSwvLAK92UBuY7TpWx52+tIwvoJMvPQn/6cVWpkO432kkqn UD66lZARUPnp2XZXL+aIky1tgd7yaXI3J3XaNVfbojI+zpsW/TX9VDDnGQLIEpneXM7h dF0zrPTy2b3XuNcsgIgxC2ujpYZ661PUxGE1i3L9u61KXJ4uUleXq5CuWxzvIXb7Uc/h 9R7A== X-Gm-Message-State: ANoB5pl9mM0nreOPjhlcg2ty07igODC1shi70WGcTVz1tCp0xp7uUFwO r5+33RCtKUbdHAquRap1Ep4RDWrTmgyQ5r6L X-Google-Smtp-Source: AA0mqf7lXldypD615/dGkqJ5u982Hs+/norrkKk1lGt7gUvMBEH3NPw/7Jq/AE3D0tjZF3wmnPez0w== X-Received: by 2002:a63:f346:0:b0:477:b53d:19 with SMTP id t6-20020a63f346000000b00477b53d0019mr59075712pgj.166.1670403321958; Wed, 07 Dec 2022 00:55:21 -0800 (PST) Received: from localhost.localdomain ([27.110.126.54]) by smtp.gmail.com with ESMTPSA id l16-20020a170903121000b0018157b415dbsm14145514plh.63.2022.12.07.00.55.18 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 07 Dec 2022 00:55:21 -0800 (PST) From: Simon Glass To: U-Boot Mailing List Cc: U-Boot Custodians , Simon Glass , Marek Vasut , Pavel Herrmann , Sean Anderson Subject: [PATCH 26/71] dm: usb: Mark the device name as alloced when binding Date: Wed, 7 Dec 2022 21:50:52 +1300 Message-Id: <20221207085137.445249-27-sjg@chromium.org> X-Mailer: git-send-email 2.39.0.rc0.267.gcb52ba06e7-goog In-Reply-To: <20221207085137.445249-1-sjg@chromium.org> References: <20221207085137.445249-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 --- 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.rc0.267.gcb52ba06e7-goog