From mboxrd@z Thu Jan 1 00:00:00 1970 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 B2314C4332F for ; Mon, 19 Dec 2022 08:51:45 +0000 (UTC) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id D9BBE8543D; Mon, 19 Dec 2022 09:49:00 +0100 (CET) Authentication-Results: phobos.denx.de; dmarc=pass (p=quarantine dis=none) header.from=microchip.com Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de Authentication-Results: phobos.denx.de; dkim=pass (2048-bit key; unprotected) header.d=microchip.com header.i=@microchip.com header.b="qR5eEtd5"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 1E6CC85456; Mon, 19 Dec 2022 09:48:57 +0100 (CET) Received: from esa.microchip.iphmx.com (esa.microchip.iphmx.com [68.232.154.123]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by phobos.denx.de (Postfix) with ESMTPS id 4867885466 for ; Mon, 19 Dec 2022 09:48:54 +0100 (CET) Authentication-Results: phobos.denx.de; dmarc=pass (p=quarantine dis=none) header.from=microchip.com Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=Sergiu.Moga@microchip.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=microchip.com; i=@microchip.com; q=dns/txt; s=mchp; t=1671439735; x=1702975735; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=6Rk0ms/OSx1cbQ+YYHF3ZNDsWWR1RfV44tvqfpiMsuk=; b=qR5eEtd5YHJeRREM+kP4VzArTsIoZAjWTYyQE1Yh7IEk2tCR6rqt0TWz WId7+1LbgMXpwZBdZrfgx1EPqX78UX7kQDVHLzLbOfAamIVuCNuFkO/zi 5x0JwGTqJQYr0zeubetCfN1riVN9fnhBZnm/0om7sME0ij8EoPRY1w3a7 vi2wQ7zuoOM3GjEctVHhasBmCfHUhm8sz9+bB6Upfbp2LJqUnok0eBxPr 8KnUDPES6tOXu/bkAhUz7+pSinsMzSJAMxOYqjzJ+bu9U0+wS83mQ8D6y ksiIEUA5U8P4HGnj7U2Aihuuc5skidMHNu71sHtu5wefARsg5CpoRfnHe w==; X-IronPort-AV: E=Sophos;i="5.96,255,1665471600"; d="scan'208";a="188775888" Received: from unknown (HELO email.microchip.com) ([170.129.1.10]) by esa4.microchip.iphmx.com with ESMTP/TLS/AES256-SHA256; 19 Dec 2022 01:48:53 -0700 Received: from chn-vm-ex03.mchp-main.com (10.10.85.151) by chn-vm-ex01.mchp-main.com (10.10.85.143) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.16; Mon, 19 Dec 2022 01:48:52 -0700 Received: from ROB-ULT-M68701.microchip.com (10.10.115.15) by chn-vm-ex03.mchp-main.com (10.10.85.151) with Microsoft SMTP Server id 15.1.2507.16 via Frontend Transport; Mon, 19 Dec 2022 01:48:46 -0700 From: Sergiu Moga To: , , , , , , , , , , , , , , , , , , , , , , , , , CC: Subject: [PATCH v4 19/19] usb: ohci-at91: Add `ohci_t` field in `ohci_at91_priv` Date: Mon, 19 Dec 2022 10:46:27 +0200 Message-ID: <20221219084626.34606-20-sergiu.moga@microchip.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20221219084626.34606-1-sergiu.moga@microchip.com> References: <20221219084626.34606-1-sergiu.moga@microchip.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Content-Type: text/plain 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 From: Cristian Birsan The `ohci_register` function expects that the OHCI driver's priv is a struct whose first field is of type `ohci_t`. The original conversion to DM did not have it and this inconsistency revealed itself whenever U-Boot required multiple memory allocations resulting in a memory overwrite of where this field would supposedly be. Thus, add this missing field and automatically increase the implicit size of the driver's priv to avoid whatever future memory allocations may take place from overwriting it. Fixes: de1cf0a9c6 ("drivers: usb: ohci-at91: Enable OHCI functionality and register into DM") Signed-off-by: Cristian Birsan Signed-off-by: Sergiu Moga Tested-by: Mihai Sain --- v1 -> v4: - No change drivers/usb/host/ohci-at91.c | 1 + 1 file changed, 1 insertion(+) diff --git a/drivers/usb/host/ohci-at91.c b/drivers/usb/host/ohci-at91.c index 4b1aff4127..0791769026 100644 --- a/drivers/usb/host/ohci-at91.c +++ b/drivers/usb/host/ohci-at91.c @@ -90,6 +90,7 @@ struct at91_usbh_data { }; struct ohci_at91_priv { + ohci_t ohci; struct clk *iclk; struct clk *fclk; struct clk *hclk; -- 2.34.1