All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH net-next] cassini: Make missing firmware non-fatal
@ 2013-06-30 23:13 Ben Hutchings
  2013-07-02  6:48 ` David Miller
  0 siblings, 1 reply; 2+ messages in thread
From: Ben Hutchings @ 2013-06-30 23:13 UTC (permalink / raw)
  To: David Miller; +Cc: Jose Andres Arias Velichko, 712674, netdev

[-- Attachment #1: Type: text/plain, Size: 2301 bytes --]

The firmware patch for the Saturn PHY fixes a bug, but is not absolutely
essential.  And its licence is unclear, so it is not included in all
distributions.  Just log an error message and continue if it is missing
or invalid.

References: http://bugs.debian.org/712674
Signed-off-by: Ben Hutchings <ben@decadent.org.uk>
Tested-by: Jose Andres Arias Velichko <Andres.Arias@PaisLinux.net> (against 3.2)
---
 drivers/net/ethernet/sun/cassini.c |   18 ++++++++----------
 1 file changed, 8 insertions(+), 10 deletions(-)

diff --git a/drivers/net/ethernet/sun/cassini.c b/drivers/net/ethernet/sun/cassini.c
index 4c682a3..759441b 100644
--- a/drivers/net/ethernet/sun/cassini.c
+++ b/drivers/net/ethernet/sun/cassini.c
@@ -808,44 +808,43 @@ static int cas_reset_mii_phy(struct cas *cp)
 	return limit <= 0;
 }
 
-static int cas_saturn_firmware_init(struct cas *cp)
+static void cas_saturn_firmware_init(struct cas *cp)
 {
 	const struct firmware *fw;
 	const char fw_name[] = "sun/cassini.bin";
 	int err;
 
 	if (PHY_NS_DP83065 != cp->phy_id)
-		return 0;
+		return;
 
 	err = request_firmware(&fw, fw_name, &cp->pdev->dev);
 	if (err) {
 		pr_err("Failed to load firmware \"%s\"\n",
 		       fw_name);
-		return err;
+		return;
 	}
 	if (fw->size < 2) {
 		pr_err("bogus length %zu in \"%s\"\n",
 		       fw->size, fw_name);
-		err = -EINVAL;
 		goto out;
 	}
 	cp->fw_load_addr= fw->data[1] << 8 | fw->data[0];
 	cp->fw_size = fw->size - 2;
 	cp->fw_data = vmalloc(cp->fw_size);
-	if (!cp->fw_data) {
-		err = -ENOMEM;
+	if (!cp->fw_data)
 		goto out;
-	}
 	memcpy(cp->fw_data, &fw->data[2], cp->fw_size);
 out:
 	release_firmware(fw);
-	return err;
 }
 
 static void cas_saturn_firmware_load(struct cas *cp)
 {
 	int i;
 
+	if (!cp->fw_data)
+		return;
+
 	cas_phy_powerdown(cp);
 
 	/* expanded memory access mode */
@@ -5083,8 +5082,7 @@ static int cas_init_one(struct pci_dev *pdev, const struct pci_device_id *ent)
 	if (cas_check_invariants(cp))
 		goto err_out_iounmap;
 	if (cp->cas_flags & CAS_FLAG_SATURN)
-		if (cas_saturn_firmware_init(cp))
-			goto err_out_iounmap;
+		cas_saturn_firmware_init(cp);
 
 	cp->init_block = (struct cas_init_block *)
 		pci_alloc_consistent(pdev, sizeof(struct cas_init_block),


[-- Attachment #2: This is a digitally signed message part --]
[-- Type: application/pgp-signature, Size: 828 bytes --]

^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH net-next] cassini: Make missing firmware non-fatal
  2013-06-30 23:13 [PATCH net-next] cassini: Make missing firmware non-fatal Ben Hutchings
@ 2013-07-02  6:48 ` David Miller
  0 siblings, 0 replies; 2+ messages in thread
From: David Miller @ 2013-07-02  6:48 UTC (permalink / raw)
  To: ben; +Cc: Andres.Arias, 712674, netdev

From: Ben Hutchings <ben@decadent.org.uk>
Date: Mon, 01 Jul 2013 00:13:27 +0100

> The firmware patch for the Saturn PHY fixes a bug, but is not absolutely
> essential.  And its licence is unclear, so it is not included in all
> distributions.  Just log an error message and continue if it is missing
> or invalid.
> 
> References: http://bugs.debian.org/712674
> Signed-off-by: Ben Hutchings <ben@decadent.org.uk>
> Tested-by: Jose Andres Arias Velichko <Andres.Arias@PaisLinux.net> (against 3.2)

This looks fine, applied.

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2013-07-02  6:48 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-06-30 23:13 [PATCH net-next] cassini: Make missing firmware non-fatal Ben Hutchings
2013-07-02  6:48 ` David Miller

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.