Received: by 2002:a05:6a10:1287:0:0:0:0 with SMTP id d7csp713381pxv; Thu, 15 Jul 2021 14:12:24 -0700 (PDT) X-Google-Smtp-Source: ABdhPJy0gzSlXHMv/6LojBxu87nXapI3gTFjbR3E3ix2hv/00kq6lE4KJNroW0b/2b7jgL2C9ci6 X-Received: by 2002:a50:ef0e:: with SMTP id m14mr9764640eds.306.1626383544215; Thu, 15 Jul 2021 14:12:24 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1626383544; cv=none; d=google.com; s=arc-20160816; b=GtNxi5ra4oJUXpM87yQFg+U6q752o4kRkFJDFFdWlK6nG1USCFjuUeR+aWjy1oE0lf k2lTd2C7Tvwz4sjvLtL/8vBbUzJKJq6Dvy5JkxWcLUJe4JhMqZlG0gmazC3UfbsC5kW5 /5hY/5Wfhkd9m0Y7MjjA62vDGdiuieM35y4S3CB0bL9Kb+sXCIYzvn2cxAlEWhLapJTB sc4Ar/jASNpnYyvU+BtpaqzbMepS7DKu5bDzn/BiYsNZsGGIh5Llrk+vfFJx3VKDYho3 fLZwyMiNStzUl+tAeB5mKUBBxvYXi73p6nGzGPQmQP5lEEsRPECJz+t6HgFDRPOKEhaj zbTQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=k60a6O67uAgaAF4s1NpEIHLBBDxW3ovUAmicYeNlmgA=; b=MIASazkIFcZFiIlto49El4GipWpyt7k/Zem0jCH/+y8tvXa0kTuR7iwxlvMFY92mDQ WalzhYUzyk9Mjcyl5R9Z/RDn7rhVfRO1qYUxpAIumcWs+wqG0MWEi8xRiIG2Dc8uJpYH J904fj0g2JuIsdr8GoWEKNHjfdqE3ZvL/cwpB2w7O+svyj8ShcoDpiA4U+iJ76zWUEk0 WzmE33fcM/F2/h5xxdDV98ZmlP/M9ptYrgSEgmlOwU8L45l4QWt/LoiOXIvARGZuZysW B3sxEDN7FoQqcu1tMP/op7WFcMoBChzdIooiiiJ58C6gtoWjgfPA+Nv7AyEAuvIbiAQH G1XA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=rmexCCfY; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id bs19si8323532ejb.398.2021.07.15.14.12.01; Thu, 15 Jul 2021 14:12:24 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=rmexCCfY; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1345137AbhGOTar (ORCPT + 99 others); Thu, 15 Jul 2021 15:30:47 -0400 Received: from mail.kernel.org ([198.145.29.99]:45628 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S243070AbhGOTJZ (ORCPT ); Thu, 15 Jul 2021 15:09:25 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id 5ADBE613FB; Thu, 15 Jul 2021 19:04:52 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1626375892; bh=SJnchJOCWq86jSivAcKUt8nRUW+Uh1jnOWnGDw2p6Uo=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=rmexCCfYss9kxl0yF2hhJH+xEXNXFIiiLTZ4pXfX5sBdd0kyTb8s2N2a+bdXKlj85 5AhEMiuBuY5jihUUuN35RX/XuUrb/Q7nPYpN4RnuxlXWQ94UR9HwjUWRcQlHxjtAJ7 9JOAUfv/6Die73Y38y4abzgJktTsud1WAH7WbY7Q= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Jesse Brandeburg , Tony Nguyen , Sasha Levin Subject: [PATCH 5.13 039/266] e100: handle eeprom as little endian Date: Thu, 15 Jul 2021 20:36:34 +0200 Message-Id: <20210715182621.174776980@linuxfoundation.org> X-Mailer: git-send-email 2.32.0 In-Reply-To: <20210715182613.933608881@linuxfoundation.org> References: <20210715182613.933608881@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Jesse Brandeburg [ Upstream commit d4ef55288aa2e1b76033717242728ac98ddc4721 ] Sparse tool was warning on some implicit conversions from little endian data read from the EEPROM on the e100 cards. Fix these by being explicit about the conversions using le16_to_cpu(). Signed-off-by: Jesse Brandeburg Signed-off-by: Tony Nguyen Signed-off-by: Sasha Levin --- drivers/net/ethernet/intel/e100.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/drivers/net/ethernet/intel/e100.c b/drivers/net/ethernet/intel/e100.c index f8d78af76d7d..1b0958bd24f6 100644 --- a/drivers/net/ethernet/intel/e100.c +++ b/drivers/net/ethernet/intel/e100.c @@ -1395,7 +1395,7 @@ static int e100_phy_check_without_mii(struct nic *nic) u8 phy_type; int without_mii; - phy_type = (nic->eeprom[eeprom_phy_iface] >> 8) & 0x0f; + phy_type = (le16_to_cpu(nic->eeprom[eeprom_phy_iface]) >> 8) & 0x0f; switch (phy_type) { case NoSuchPhy: /* Non-MII PHY; UNTESTED! */ @@ -1515,7 +1515,7 @@ static int e100_phy_init(struct nic *nic) mdio_write(netdev, nic->mii.phy_id, MII_BMCR, bmcr); } else if ((nic->mac >= mac_82550_D102) || ((nic->flags & ich) && (mdio_read(netdev, nic->mii.phy_id, MII_TPISTATUS) & 0x8000) && - (nic->eeprom[eeprom_cnfg_mdix] & eeprom_mdix_enabled))) { + (le16_to_cpu(nic->eeprom[eeprom_cnfg_mdix]) & eeprom_mdix_enabled))) { /* enable/disable MDI/MDI-X auto-switching. */ mdio_write(netdev, nic->mii.phy_id, MII_NCONFIG, nic->mii.force_media ? 0 : NCONFIG_AUTO_SWITCH); @@ -2269,9 +2269,9 @@ static int e100_asf(struct nic *nic) { /* ASF can be enabled from eeprom */ return (nic->pdev->device >= 0x1050) && (nic->pdev->device <= 0x1057) && - (nic->eeprom[eeprom_config_asf] & eeprom_asf) && - !(nic->eeprom[eeprom_config_asf] & eeprom_gcl) && - ((nic->eeprom[eeprom_smbus_addr] & 0xFF) != 0xFE); + (le16_to_cpu(nic->eeprom[eeprom_config_asf]) & eeprom_asf) && + !(le16_to_cpu(nic->eeprom[eeprom_config_asf]) & eeprom_gcl) && + ((le16_to_cpu(nic->eeprom[eeprom_smbus_addr]) & 0xFF) != 0xFE); } static int e100_up(struct nic *nic) @@ -2926,7 +2926,7 @@ static int e100_probe(struct pci_dev *pdev, const struct pci_device_id *ent) /* Wol magic packet can be enabled from eeprom */ if ((nic->mac >= mac_82558_D101_A4) && - (nic->eeprom[eeprom_id] & eeprom_id_wol)) { + (le16_to_cpu(nic->eeprom[eeprom_id]) & eeprom_id_wol)) { nic->flags |= wol_magic; device_set_wakeup_enable(&pdev->dev, true); } -- 2.30.2