All of lore.kernel.org
 help / color / mirror / Atom feed
From: Linyu Yuan <quic_linyyuan@quicinc.com>
To: Heikki Krogerus <heikki.krogerus@linux.intel.com>,
	Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Cc: <linux-usb@vger.kernel.org>, Jack Pham <quic_jackp@quicinc.com>,
	"Linyu Yuan" <quic_linyyuan@quicinc.com>
Subject: [PATCH v4 2/3] usb: typec: ucsi: do not allocate one extra unused connector
Date: Thu, 21 Apr 2022 18:09:19 +0800	[thread overview]
Message-ID: <1650535760-18624-3-git-send-email-quic_linyyuan@quicinc.com> (raw)
In-Reply-To: <1650535760-18624-1-git-send-email-quic_linyyuan@quicinc.com>

ucsi_connector_clean() will use actual connector number in the loop,
there is no need to allocate one extra as the ending.

Signed-off-by: Linyu Yuan <quic_linyyuan@quicinc.com>
---
v2: new change
v3: no change
v4: fix a typo extral -> extra in 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


  parent reply	other threads:[~2022-04-21 10:10 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-04-21 10:09 [PATCH v4 0/3] usb: typec: ucsi: allow retry to find role switch Linyu Yuan
2022-04-21 10:09 ` [PATCH v4 1/3] usb: typec: ucsi: add a common function ucsi_unregister_connectors() Linyu Yuan
2022-04-21 10:09 ` Linyu Yuan [this message]
2022-04-21 10:09 ` [PATCH v4 3/3] usb: typec: ucsi: Wait for the USB role switches Linyu Yuan

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1650535760-18624-3-git-send-email-quic_linyyuan@quicinc.com \
    --to=quic_linyyuan@quicinc.com \
    --cc=gregkh@linuxfoundation.org \
    --cc=heikki.krogerus@linux.intel.com \
    --cc=linux-usb@vger.kernel.org \
    --cc=quic_jackp@quicinc.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.