* [PATCH] phy: qcom-usb-hs: use flexible array member
@ 2026-03-15 21:49 Rosen Penev
2026-05-14 16:18 ` Vinod Koul
0 siblings, 1 reply; 2+ messages in thread
From: Rosen Penev @ 2026-03-15 21:49 UTC (permalink / raw)
To: linux-phy
Cc: Vinod Koul, Neil Armstrong, open list:ARM/QUALCOMM MAILING LIST,
open list
Simplify allocation by removing kmalloc_array and just doing kzalloc.
Signed-off-by: Rosen Penev <rosenp@gmail.com>
---
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[];
};
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;
- uphy = devm_kzalloc(&ulpi->dev, sizeof(*uphy), GFP_KERNEL);
+ size = of_property_count_u8_elems(ulpi->dev.of_node, "qcom,init-seq");
+ if (size < 0)
+ size = 0;
+
+ uphy = 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 = ulpi;
- size = of_property_count_u8_elems(ulpi->dev.of_node, "qcom,init-seq");
- if (size < 0)
- size = 0;
- uphy->init_seq = devm_kmalloc_array(&ulpi->dev, (size / 2) + 1,
- sizeof(*uphy->init_seq), GFP_KERNEL);
- if (!uphy->init_seq)
- return -ENOMEM;
ret = of_property_read_u8_array(ulpi->dev.of_node, "qcom,init-seq",
(u8 *)uphy->init_seq, size);
if (ret && size)
--
2.53.0
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: [PATCH] phy: qcom-usb-hs: use flexible array member
2026-03-15 21:49 [PATCH] phy: qcom-usb-hs: use flexible array member Rosen Penev
@ 2026-05-14 16:18 ` Vinod Koul
0 siblings, 0 replies; 2+ messages in thread
From: Vinod Koul @ 2026-05-14 16:18 UTC (permalink / raw)
To: linux-phy, Rosen Penev; +Cc: Neil Armstrong, linux-arm-msm, linux-kernel
On Sun, 15 Mar 2026 14:49:30 -0700, Rosen Penev wrote:
> Simplify allocation by removing kmalloc_array and just doing kzalloc.
>
>
Applied, thanks!
[1/1] phy: qcom-usb-hs: use flexible array member
commit: deb281cec3cbef5f02c6bc29fa5cd51f6d5be10f
Best regards,
--
~Vinod
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2026-05-14 16:18 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-03-15 21:49 [PATCH] phy: qcom-usb-hs: use flexible array member Rosen Penev
2026-05-14 16:18 ` Vinod Koul
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®