cassini: Make missing firmware non-fatal
authorBen Hutchings <ben@decadent.org.uk>
Sun, 30 Jun 2013 23:13:27 +0000 (00:13 +0100)
committerDavid S. Miller <davem@davemloft.net>
Tue, 2 Jul 2013 06:47:33 +0000 (23:47 -0700)
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)
Signed-off-by: David S. Miller <davem@davemloft.net>
drivers/net/ethernet/sun/cassini.c

index 4c682a3d04240b47efb71736b6a234fdf30cb8cf..759441b29e535b4c7b1c0f94e6f7520fc628fbdd 100644 (file)
@@ -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),