ATH10K Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: "Valo, Kalle" <kvalo@qca.qualcomm.com>
To: Erik Stromdahl <erik.stromdahl@gmail.com>
Cc: "linux-wireless@vger.kernel.org" <linux-wireless@vger.kernel.org>,
	"ath10k@lists.infradead.org" <ath10k@lists.infradead.org>
Subject: Re: [RFC v4 06/21] ath10k: sdio support
Date: Fri, 10 Mar 2017 12:11:40 +0000	[thread overview]
Message-ID: <8760jh2uy8.fsf@kamboji.qca.qualcomm.com> (raw)
In-Reply-To: <1487693741-10042-7-git-send-email-erik.stromdahl@gmail.com> (Erik Stromdahl's message of "Tue, 21 Feb 2017 17:15:26 +0100")

Erik Stromdahl <erik.stromdahl@gmail.com> writes:

> sdio/mailbox HIF implementation.
>
> Signed-off-by: Erik Stromdahl <erik.stromdahl@gmail.com>

I'm looking at this more carefully now and noticed this:

> +static int ath10k_sdio_bmi_credits(struct ath10k *ar)
> +{
> +	int ret;
> +	u32 addr, *cmd_credits;
> +	unsigned long timeout;
> +
> +	cmd_credits = kzalloc(sizeof(*cmd_credits), GFP_KERNEL);
> +	if (!cmd_credits) {
> +		ret = -ENOMEM;
> +		goto err;
> +	}
> +
> +	/* Read the counter register to get the command credits */
> +	addr = MBOX_COUNT_DEC_ADDRESS + ATH10K_HIF_MBOX_NUM_MAX * 4;
> +
> +	timeout = jiffies + BMI_COMMUNICATION_TIMEOUT_HZ;
> +	while (time_before(jiffies, timeout) && !*cmd_credits) {
> +		/* Hit the credit counter with a 4-byte access, the first byte
> +		 * read will hit the counter and cause a decrement, while the
> +		 * remaining 3 bytes has no effect. The rationale behind this
> +		 * is to make all HIF accesses 4-byte aligned.
> +		 */
> +		ret = ath10k_sdio_read_write_sync(ar, addr,
> +						  (u8 *)cmd_credits,
> +						  sizeof(*cmd_credits),
> +						  HIF_RD_SYNC_BYTE_INC);
> +		if (ret) {
> +			ath10k_warn(ar,
> +				    "Unable to decrement the command credit count register: %d\n",
> +				    ret);
> +			goto err_free;
> +		}
> +
> +		/* The counter is only 8 bits.
> +		 * Ignore anything in the upper 3 bytes
> +		 */
> +		*cmd_credits &= 0xFF;
> +	}
> +
> +	if (!*cmd_credits) {
> +		ath10k_warn(ar, "bmi communication timeout\n");
> +		ret = -ETIMEDOUT;
> +		goto err_free;
> +	}
> +
> +	return 0;
> +err_free:
> +	kfree(cmd_credits);
> +err:
> +	return ret;
> +}

AFAICS we are leaking cmd_credits if there's no error. Or is the buffer
freed somewhere within the mmc stack or something? The reason why I ask
is that I saw the same pattern in multiple functions so I'm curious.

-- 
Kalle Valo
_______________________________________________
ath10k mailing list
ath10k@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/ath10k

  reply	other threads:[~2017-03-10 12:12 UTC|newest]

Thread overview: 33+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-02-21 16:15 [RFC v4 00/21] ath10k sdio and usb support Erik Stromdahl
2017-02-21 16:15 ` [RFC v4 01/21] ath10k: htc: made static function public Erik Stromdahl
2017-02-21 16:15 ` [RFC v4 02/21] ath10k: htc: rx trailer lookahead support Erik Stromdahl
2017-02-21 16:15 ` [RFC v4 03/21] ath10k: htc: move htc ctrl ep connect to htc_init Erik Stromdahl
2017-02-21 16:15 ` [RFC v4 04/21] ath10k: htc: refactorization Erik Stromdahl
2017-02-21 16:15 ` [RFC v4 05/21] ath10k: various sdio related definitions Erik Stromdahl
2017-02-21 16:15 ` [RFC v4 06/21] ath10k: sdio support Erik Stromdahl
2017-03-10 12:11   ` Valo, Kalle [this message]
2017-03-10 12:43     ` Valo, Kalle
2017-03-10 16:29       ` Erik Stromdahl
2017-03-11 10:36         ` Erik Stromdahl
2017-03-11 15:04           ` Kalle Valo
2017-03-11 19:10             ` Erik Stromdahl
2017-03-15 12:09         ` Kalle Valo
2017-03-15 18:01           ` Erik Stromdahl
2017-03-16  9:33             ` Kalle Valo
2017-03-17 15:54               ` Erik Stromdahl
2017-03-23 16:10                 ` Kalle Valo
2017-02-21 16:15 ` [RFC v4 07/21] ath10k: add sdio extra initializations Erik Stromdahl
2017-02-21 16:15 ` [RFC v4 08/21] ath10k: sdio get target info Erik Stromdahl
2017-02-21 16:15 ` [RFC v4 09/21] ath10k: htc: ready_ext msg support Erik Stromdahl
2017-02-21 16:15 ` [RFC v4 10/21] ath10k: various usb related definitions Erik Stromdahl
2017-02-21 16:15 ` [RFC v4 11/21] ath10k: usb support Erik Stromdahl
2017-02-21 16:15 ` [RFC v4 12/21] ath10k: high_latency detection Erik Stromdahl
2017-02-21 16:15 ` [RFC v4 13/21] ath10k: different fw file names for usb and sdio Erik Stromdahl
2017-02-21 16:15 ` [RFC v4 14/21] ath10k: htt: RX ring config HL support Erik Stromdahl
2017-02-21 16:15 ` [RFC v4 15/21] ath10k: per target configurablity of various items Erik Stromdahl
2017-02-21 16:15 ` [RFC v4 16/21] ath10k: add start_once support Erik Stromdahl
2017-02-21 16:15 ` [RFC v4 17/21] ath10k: htt: High latency TX support Erik Stromdahl
2017-02-21 16:15 ` [RFC v4 18/21] ath10k: htt: High latency RX support Erik Stromdahl
2017-02-21 16:15 ` [RFC v4 19/21] ath10k: add QCA9377 usb hw_param item Erik Stromdahl
2017-02-21 16:15 ` [RFC v4 20/21] ath10k: add QCA9377 sdio " Erik Stromdahl
2017-02-21 16:15 ` [RFC v4 21/21] ath10k: dma fixes for high latency devices Erik Stromdahl

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=8760jh2uy8.fsf@kamboji.qca.qualcomm.com \
    --to=kvalo@qca.qualcomm.com \
    --cc=ath10k@lists.infradead.org \
    --cc=erik.stromdahl@gmail.com \
    --cc=linux-wireless@vger.kernel.org \
    /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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox