From: Kalle Valo <kvalo@qca.qualcomm.com>
To: Joe Perches <joe@perches.com>
Cc: "Luis R. Rodriguez" <rodrigue@qca.qualcomm.com>,
<linville@tuxdriver.com>, <linux-wireless@vger.kernel.org>
Subject: Re: [PATCH 1/6] ath6kl: fix sparse warning on init.c
Date: Fri, 23 Dec 2011 10:27:49 +0200 [thread overview]
Message-ID: <4EF43B85.9050000@qca.qualcomm.com> (raw)
In-Reply-To: <1324431770.14214.0.camel@joe2Laptop>
On 12/21/2011 03:42 AM, Joe Perches wrote:
> On Tue, 2011-12-20 at 21:40 +0200, Kalle Valo wrote:
>> On 12/20/2011 08:46 PM, Luis R. Rodriguez wrote:
>>
>> for (i = 0; i < ARRAY_SIZE(hw_list); i++) {
>> hw = &hw_list[i];
>>
>> if (hw->id == ar->version.target_ver)
>> break;
>> }
>>
>> if (i == ARRAY_SIZE(hw_list)) {
>> ath6kl_err("Unsupported hardware version: 0x%x\n",
>> ar->version.target_ver);
>> return -EINVAL;
>> }
>>
>> ar->hw = *hw;
>>
>> I always check for both compiler and sparse warnings and I have never
>> seen this. What version of compiler do you have?
>
> Is the intent here really to allow multiple ids
> in the list and match the last one?
The idea is that there should be just one hw entry per id. But if there
would be multiple entires, the code above would take the first one.
> If not, perhaps this is simpler?
>
> static int ath6kl_init_hw_params(struct ath6kl *ar)
> {
> int i;
> const struct ath6kl_hw *hw = hw_list;
>
> for (i = 0; i < ARRAY_SIZE(hw_list); i++) {
> if (hw->id == ar->version.target_ver) {
> ar->hw = *hw;
>
> ath6kl_dbg(ATH6KL_DBG_BOOT,
> "target_ver 0x%x target_type 0x%x dataset_patch 0x%x app_load_addr 0x%x\n",
> ar->version.target_ver, ar->target_type,
> ar->hw.dataset_patch_addr,
> ar->hw.app_load_addr);
> ath6kl_dbg(ATH6KL_DBG_BOOT,
> "app_start_override_addr 0x%x board_ext_data_addr 0x%x reserved_ram_size 0x%x\n",
> ar->hw.app_start_override_addr,
> ar->hw.board_ext_data_addr,
> ar->hw.reserved_ram_size);
> ath6kl_dbg(ATH6KL_DBG_BOOT,
> "refclk_hz %d uarttx_pin %d\n",
> ar->hw.refclk_hz, ar->hw.uarttx_pin);
>
> return 0;
> }
> hw++;
> }
>
> ath6kl_err("Unsupported hardware version: 0x%x\n",
> ar->version.target_ver);
> return -EINVAL;
> }
There's a lot of indentation in that form which I don't like. And I
would prefer to have the "main" (non-error) code path unindented. Easier
to read that way.
> btw: there are missing terminating newlines in the
> existing ath6kl_dbg uses in this routine.
Thanks, I didn't notice that. That needs to be fixed.
Kalle
next prev parent reply other threads:[~2011-12-23 8:28 UTC|newest]
Thread overview: 20+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-12-20 18:46 [PATCH 0/6] atheros-wireless: fix sparse warnings ho ho ho Luis R. Rodriguez
2011-12-20 18:46 ` [PATCH 1/6] ath6kl: fix sparse warning on init.c Luis R. Rodriguez
2011-12-20 18:49 ` Luis R. Rodriguez
2011-12-20 19:40 ` Kalle Valo
2011-12-20 19:46 ` Luis R. Rodriguez
2011-12-20 20:02 ` Kalle Valo
2011-12-21 1:41 ` Joe Perches
2011-12-21 1:42 ` Joe Perches
2011-12-23 8:27 ` Kalle Valo [this message]
2011-12-20 18:46 ` [PATCH 2/6] ath9k: make ath_mci_duty_cycle static Luis R. Rodriguez
2011-12-21 4:41 ` Joe Perches
2011-12-21 17:26 ` Luis R. Rodriguez
2011-12-20 18:46 ` [PATCH 3/6] ath9k_hw: fix sparse warnings on ar9003_rtt.c Luis R. Rodriguez
2011-12-20 18:46 ` [PATCH 4/6] ath9k: fix tx queue sparse complaint Luis R. Rodriguez
2011-12-20 18:46 ` [PATCH 5/6] ath5k: avoid sparse warnings on tracing Luis R. Rodriguez
2011-12-21 15:15 ` Johannes Berg
2011-12-21 16:04 ` Luis R. Rodriguez
2011-12-20 18:46 ` [PATCH 6/6] ath9k_hw: fix sparse complaint on ar9003_switch_com_spdt_get() Luis R. Rodriguez
2011-12-20 19:01 ` [PATCH 0/6] atheros-wireless: fix sparse warnings ho ho ho Larry Finger
2011-12-20 19:12 ` Luis R. Rodriguez
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=4EF43B85.9050000@qca.qualcomm.com \
--to=kvalo@qca.qualcomm.com \
--cc=joe@perches.com \
--cc=linux-wireless@vger.kernel.org \
--cc=linville@tuxdriver.com \
--cc=rodrigue@qca.qualcomm.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).