In ucsi_init(), it allocate number of (ucsi->cap.num_connectors + 1) connectors, there is one extra as the ending. ucsi_unregister_connectors() is safe to unregister all ucsi connectors according ucsi->cap.num_connectors. Let's remove the extra one connector to save memory. Signed-off-by: Linyu Yuan <quic_linyyuan@xxxxxxxxxxx> --- v2: new change v3: no change v4: fix a typo extral -> extra in commit description v5: update commit description drivers/usb/typec/ucsi/ucsi.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/usb/typec/ucsi/ucsi.c b/drivers/usb/typec/ucsi/ucsi.c index af9a2a1..ce9192e 100644 --- a/drivers/usb/typec/ucsi/ucsi.c +++ b/drivers/usb/typec/ucsi/ucsi.c @@ -1251,7 +1251,7 @@ static int ucsi_init(struct ucsi *ucsi) } /* Allocate the connectors. Released in ucsi_unregister() */ - ucsi->connector = kcalloc(ucsi->cap.num_connectors + 1, + ucsi->connector = kcalloc(ucsi->cap.num_connectors, sizeof(*ucsi->connector), GFP_KERNEL); if (!ucsi->connector) { ret = -ENOMEM; -- 2.7.4