From nobody Tue Apr 7 06:31:30 2026 Received: from mail-pl1-f172.google.com (mail-pl1-f172.google.com [209.85.214.172]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id A36A137CD41 for ; Sun, 15 Mar 2026 21:49:48 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.214.172 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1773611390; cv=none; b=JPROYnEnIgeU+iE+h8Jv9BQLah3J7d4pi5rd6hj6RJC7WMDz9Mq0JbcmEVmKzIc3z9/l6/LdtQ5ZmaYv1zdMhYDP1XDTxLgf+ndYoj8BYEmZfzaoBwKD3bTw687bRMfCqToGtjUY5Z6vGTynMo+5JDGjbQE9XwLrFoHnt92YEJ0= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1773611390; c=relaxed/simple; bh=1+OQKMD/CDckp0yWxZa9Evr03RSgcFZmtdVhDhwjsEc=; h=From:To:Cc:Subject:Date:Message-ID:MIME-Version; b=T2AQCZQh9mxF5/N8VotstZEI0mNdL0Q9eoXXpaAm9hD3ojRawKDSvob9pgrRvEASwnQobFs4DHeXoJOLlbLjp65gLdyRpFtDrDmnYSJ3qbSLqjM8RVfo035NjQiD4F74G8E9p8oNI+7eKwKMNBkx9Zm+9OJwTkx0ap4R2LkywOI= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=WGcSX6Bv; arc=none smtp.client-ip=209.85.214.172 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="WGcSX6Bv" Received: by mail-pl1-f172.google.com with SMTP id d9443c01a7336-2a9296b3926so30628745ad.1 for ; Sun, 15 Mar 2026 14:49:48 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1773611388; x=1774216188; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:from:to:cc:subject:date:message-id:reply-to; bh=yyQZotK09J79wwzOqO2g7g0QUr0ijW8kVif2Dvv/7Zs=; b=WGcSX6BvwkHrICrJtwrohBbv3i3iMJZn4pnmR/myzoEgkFslRyquAIalKFNStLDFVR Z843lBlOiNq7hf7MNa0lXFYWf652Y02sftJFcUiOlAtf+cJIDVqt9BhQzDIEK5PwJ/Vv NLjyoiSOMUs+fYacPiGh0S6eCoLcqzbmOquJUiKbE2vY8ZbS/TMFwjI+VrIDQJbTlb55 eUW5APB9grf/1qY1GSAzYe9Ip9oDmeTdS1qWP8QY7pBFOrqk3TSybVDwodTlS+/JwtO/ /FwqhAy0aIhLbmcG1vqqtO+CmBHw7+S4cAkxuUeAyseglbEG22QN/qc4OTc8XVgC122Y jGcw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1773611388; x=1774216188; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:x-gm-gg:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to; bh=yyQZotK09J79wwzOqO2g7g0QUr0ijW8kVif2Dvv/7Zs=; b=oIcBPcwgG9xNrERmnMfLXXPk82xgRTfZ87x+ZEJrO5yD88jUI72LLh2RrdxxSVY9r4 1AyOXpdJuhfTGDuuKL038SUM1HXNVNVSoFSwraP0IKz3dQAce+YVqgc0U+ahn3JYogiN UR4BE0NczANsKMFiOxQDgN6qWsHW/zWe2530RurlShifaIVgMt6mS330XqZWcaspCOFX l2WHibBs/Lw49wbf8XoPwuFPvVOUyVRGCGoHwjVph2OC7xyPDfRLMWT+jvERWtrBgtPE eoXXXshhFMtprtIlGGKAFHbbMhMZh+KzQg5xaUPcineOfFfqqWVyMxAIKWcH6nsCVScl rRlw== X-Forwarded-Encrypted: i=1; AJvYcCUlT1Qb5W6xrk1UcsNGhSNtEplo7Zr0DAXYviafJeD1HdI/je8Krt6I2huj1wonQ49SKCZsgR7b5FtBlOo=@vger.kernel.org X-Gm-Message-State: AOJu0Yy1VHZB2QQu73ucHF//1v8Sug/OLyRqR5wSvzb5AaQUlCgFLtvF OelNMeAth3jJ6S2QTGlmCNRp6taLR51nP7IqMyc+JDjuzb20HqL3L1uH X-Gm-Gg: ATEYQzwbjZmZrc9cNwS8miAxmUOEBI885m9fejwT0fgfr9EZF5x66+wCNf4T41/0fVW Rmj8Z8PFZuoKxBtlgDpym89hPMtdes4e+0vXVZES8oPcS0eMTdDSFpalVHgs62KiT2BomVZD+8R 0PtfQCEzPmydmFdX7vfk9gB6+RQnG+noUChnLRegxva+14WxuDrhAF758awcczFzPqsBG55aMof U8p5me5mk1wiyE6VlvOONRll4lLu42a6bdkIZB5lDQH6VrF0OEjpJx/fJDxszqZl5Ta6DGy2Ubu NLNFvaQMLn7soxQFcSicYJn5L0v3esKT2/QEOCdxde6hSENM9r1tMr7W+aLOa6ghyxy4mipEFfP uNFpqz97RG3Pij6uAkQHOzhL6adCG9N0Aho7+ghNnrMlnvX2FjwOXzEp6VZmfg9KMibsZuRkXDW xCyWtUPZljFzCIUIZB37nJrilSMoU+raInQ5j5jwzkbsIOOGyDOAy0WZQ= X-Received: by 2002:a05:6a20:1603:b0:398:b178:a53f with SMTP id adf61e73a8af0-398ecca3e40mr10326239637.40.1773611387990; Sun, 15 Mar 2026 14:49:47 -0700 (PDT) Received: from ryzen ([2601:644:8000:56f5::8bd]) by smtp.gmail.com with ESMTPSA id 41be03b00d2f7-c73ebb6336bsm7896099a12.21.2026.03.15.14.49.47 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 15 Mar 2026 14:49:47 -0700 (PDT) From: Rosen Penev To: linux-phy@lists.infradead.org Cc: Vinod Koul , Neil Armstrong , linux-arm-msm@vger.kernel.org (open list:ARM/QUALCOMM MAILING LIST), linux-kernel@vger.kernel.org (open list) Subject: [PATCH] phy: qcom-usb-hs: use flexible array member Date: Sun, 15 Mar 2026 14:49:30 -0700 Message-ID: <20260315214930.4621-1-rosenp@gmail.com> X-Mailer: git-send-email 2.53.0 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" Simplify allocation by removing kmalloc_array and just doing kzalloc. Signed-off-by: Rosen Penev --- drivers/phy/qualcomm/phy-qcom-usb-hs.c | 15 ++++++--------- 1 file changed, 6 insertions(+), 9 deletions(-) diff --git a/drivers/phy/qualcomm/phy-qcom-usb-hs.c b/drivers/phy/qualcomm/= phy-qcom-usb-hs.c index 98a18987f1be..928a982a8a76 100644 --- a/drivers/phy/qualcomm/phy-qcom-usb-hs.c +++ b/drivers/phy/qualcomm/phy-qcom-usb-hs.c @@ -34,9 +34,9 @@ struct qcom_usb_hs_phy { struct regulator *v1p8; struct regulator *v3p3; struct reset_control *reset; - struct ulpi_seq *init_seq; struct extcon_dev *vbus_edev; struct notifier_block vbus_notify; + struct ulpi_seq init_seq[]; }; =20 static int qcom_usb_hs_phy_set_mode(struct phy *phy, @@ -209,19 +209,16 @@ static int qcom_usb_hs_phy_probe(struct ulpi *ulpi) int size; int ret; =20 - uphy =3D devm_kzalloc(&ulpi->dev, sizeof(*uphy), GFP_KERNEL); + size =3D of_property_count_u8_elems(ulpi->dev.of_node, "qcom,init-seq"); + if (size < 0) + size =3D 0; + + uphy =3D devm_kzalloc(&ulpi->dev, struct_size(uphy, init_seq, (size / 2) = + 1), GFP_KERNEL); if (!uphy) return -ENOMEM; ulpi_set_drvdata(ulpi, uphy); uphy->ulpi =3D ulpi; =20 - size =3D of_property_count_u8_elems(ulpi->dev.of_node, "qcom,init-seq"); - if (size < 0) - size =3D 0; - uphy->init_seq =3D devm_kmalloc_array(&ulpi->dev, (size / 2) + 1, - sizeof(*uphy->init_seq), GFP_KERNEL); - if (!uphy->init_seq) - return -ENOMEM; ret =3D of_property_read_u8_array(ulpi->dev.of_node, "qcom,init-seq", (u8 *)uphy->init_seq, size); if (ret && size) --=20 2.53.0