From: Kalle Valo <kvalo@adurom.com>
To: Dan Carpenter <error27@gmail.com>
Cc: gregkh@suse.de, devel@linuxdriverproject.org,
linux-wireless@vger.kernel.org
Subject: Re: [PATCH 3/5] ath6kl: cache firmware
Date: Thu, 09 Jun 2011 16:14:34 +0300 [thread overview]
Message-ID: <871uz387ut.fsf@purkki.adurom.net> (raw)
In-Reply-To: <20110608194031.GA4069@shale.localdomain> (Dan Carpenter's message of "Wed\, 8 Jun 2011 22\:44\:04 +0300")
Dan Carpenter <error27@gmail.com> writes:
>> --- a/drivers/staging/ath6kl/os/linux/ar6000_drv.c
>> +++ b/drivers/staging/ath6kl/os/linux/ar6000_drv.c
>> @@ -954,9 +954,13 @@ ar6000_transfer_bin_file(struct ar6_softc *ar, AR6K_BIN_FILE file, u32 address,
>> const char *filename;
>> const struct firmware *fw_entry;
>> u32 fw_entry_size;
>> + u8 **buf;
>> + size_t *buf_len;
>
> Don't make buf_len a pointer that just makes the code messier.
I need the pointer later so that I can store the length:
*buf_len = fw_entry->size;
>> + if (WARN_ON((buf == NULL) || (buf_len == NULL)))
>> + return A_ERROR;
>
> This test is a nonsense. "buf" and buf_len are always valid
> pointers here.
Yeah, I tried to be extra careful here, but it looks stupid now.
> Generally, I'd almost prefer a oops with a stack trace instead of
> adding in bogus error handling code for stuff that can't happen.
Depends on the case. In devices where ar6003 is usually is used there
are no serial consoles nor any other way to debug the crash.
> Also "buf" is never initialized to NULL, so if there were a
> programming bug introduced, it would generate an uninitialized
> variable warning even without the superflous test. So lets remove
> it.
You have a point, I'll remove the test. I'll send v2.
>> + if (*buf == NULL) {
>> + if ((A_REQUEST_FIRMWARE(&fw_entry, filename, ((struct device *)ar->osDevInfo.pOSDevice))) != 0)
>> + {
> ^
>
> This is on the wrong line.
I'll answer this and all the other style comments in one go:
All the style issues are from the original code. I want to separate
functional and cleanup patches so I didn't do any cleanup in this
patch. But as we are doing the cleanup in a different tree anyway I
didn't see the point of sending a separate cleanup patch.
--
Kalle Valo
next prev parent reply other threads:[~2011-06-09 13:14 UTC|newest]
Thread overview: 23+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-06-08 11:54 [PATCH 0/5] ath6kl: staging fixes Kalle Valo
2011-06-08 11:54 ` [PATCH 1/5] ath6kl: export firmware version to user space Kalle Valo
2011-06-08 11:54 ` [PATCH 2/5] ath6kl: testmode support Kalle Valo
2011-06-08 19:46 ` Dan Carpenter
2011-06-09 13:02 ` Kalle Valo
2011-06-08 11:54 ` [PATCH 3/5] ath6kl: cache firmware Kalle Valo
2011-06-08 19:44 ` Dan Carpenter
2011-06-09 13:14 ` Kalle Valo [this message]
2011-06-09 15:42 ` Dan Carpenter
2011-06-09 20:46 ` Dan Carpenter
2011-06-13 7:49 ` Kalle Valo
2011-06-08 11:54 ` [PATCH 4/5] ath6kl: Fix a kernel panic furing suspend/resume Kalle Valo
2011-06-08 11:55 ` [PATCH 5/5] ath6kl: fix crash when interface is closed but scan is ongoing Kalle Valo
2011-06-08 20:03 ` Dan Carpenter
2011-06-08 20:14 ` Dan Carpenter
2011-06-09 13:23 ` Kalle Valo
2011-06-09 15:24 ` Dan Carpenter
2011-06-13 7:52 ` Kalle Valo
2011-06-13 7:55 ` Dan Carpenter
2011-06-13 8:03 ` Kalle Valo
2011-06-13 8:18 ` Dan Carpenter
2011-06-13 8:21 ` Kalle Valo
2011-06-09 13:19 ` Kalle Valo
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=871uz387ut.fsf@purkki.adurom.net \
--to=kvalo@adurom.com \
--cc=devel@linuxdriverproject.org \
--cc=error27@gmail.com \
--cc=gregkh@suse.de \
--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