Sophie

Sophie

distrib > Scientific%20Linux > 5x > x86_64 > by-pkgid > 27922b4260f65d317aabda37e42bbbff > files > 2542

kernel-2.6.18-238.el5.src.rpm

From: Andy Gospodarek <gospo@redhat.com>
Date: Tue, 9 Dec 2008 10:13:15 -0500
Subject: [net] cxgb3: fixup embedded firmware problems take 2
Message-id: 20081209151309.GB16271@gospo.rdu.redhat.com
O-Subject: Re: [RHEL5.3 PATCH] cxgb3: fixup embedded firmware problems
Bugzilla: 469774
RH-Acked-by: Tomas Henzl <thenzl@redhat.com>
RH-Acked-by: Jiri Pirko <jpirko@redhat.com>

On Tue, Dec 09, 2008 at 03:18:13PM +0100, Jiri Pirko wrote:
> > This should resolve the problems that arose from the patch I mistakenly
> > posted last week and was included in the last snapshot.
> >
> > One thing different about this patch, is the local disk is first checked
> > for firmware, and if it's not available the embedded firmware is used.
> > The advantage here is that any locally installed firmware with the
> > correct name will be used before the embedded firmware.  This will be
> > helpful if Chelsio finds a bug in their existing firmware and needs a
> > way to get a quick update out without having to load new kernels.
> >
> > This patch as in my test kernels and has been tested by myself as well
> > as the reporter.  This will resolve RHBZ 469774.
> >
> Should not be here sizeof(**firmware) ?
> >  		if (!firmware) {
> and !(*firmware) here (or fw as Tomas suggested)
>

Hmmm, looks like the code should probably be:

		*firmware = fw = kzalloc(sizeof(*fw, GFP_KERNEL));
		if (!fw) {

instead of what's there.  That's more in-line with what is in
request_firmware.  This should fix that:

diff --git a/drivers/net/cxgb3/t3_firmware.h b/drivers/net/cxgb3/t3_firmware.h
index 1ade1cc..f2d15b1 100644
--- a/drivers/net/cxgb3/t3_firmware.h
+++ b/drivers/net/cxgb3/t3_firmware.h
@@ -2029,8 +2029,8 @@ static inline int t3_local_firmware_load(const struct firmware **firmware, const
 
 	/* if we've got a hit, allocate the memory and populate the pointer */
 	if (t3fw_entry) {
-        	*firmware = fw = kzalloc(sizeof(*firmware), GFP_KERNEL);
-		if (!firmware) {
+		*firmware = fw = kzalloc(sizeof(*fw), GFP_KERNEL);
+		if (!fw) {
 			printk(KERN_ERR "%s: kmalloc(struct firmware) failed\n",
 					__FUNCTION__);
 			return -ENOMEM;