Received: by 2002:ab2:620c:0:b0:1ef:ffd0:ce49 with SMTP id o12csp1353466lqt; Wed, 20 Mar 2024 00:47:07 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCV7oDB1GYMkTxBe4cargpNyeZsx2vF9inBVVRi5Jwk7D1O/T/72Gf8SsiYIGwTTU4bVf3pJ5K3nWIqC7ZwhQTsyiwDZp6IM+LGtQevmoA== X-Google-Smtp-Source: AGHT+IGGE2ybRrwOrGwYcmSKttPowjZaNDkXwDzq4541QVurfc6vHzeI/Gw1Z9nOfmBmzjZsflGa X-Received: by 2002:a17:906:dfeb:b0:a45:cedb:5564 with SMTP id lc11-20020a170906dfeb00b00a45cedb5564mr2998650ejc.37.1710920827706; Wed, 20 Mar 2024 00:47:07 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1710920827; cv=pass; d=google.com; s=arc-20160816; b=DcaBoeW/VsXrjFqKSUZpumBAKmJZG0Cf7WHjEWcTyMcOrYbf1nmo3+dzMngFXDYxq2 Vy+wSdMGc+aj048O/bqIT4+a5qAqifYpQbqJgxRakS4xDM8bfB7e3dC6tCwwZGJ4MB3C kQEIV/E5G4wJVhrJ7SAUNdoGFzScwCjOHAicUEVLSoBqsfJWUTwlfO2IcR7atxAkpXaG eJBT2ae3s+cTR73/P1k94xzttiHtV6u0lmFd/DK5nRhaHn5JWfM6cWBvmGgTgfxuEVsd L9qkBgZrkBimqM+YSi1BVQD/zxgz92ZgTAA636zz3QLUBn5NU4kCJ6i+5gBjvIJajNvT OBZg== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:message-id:date:subject:cc:to :from; bh=3pdq6q3WpnRo75W0nANQLKamevQLYOHaRMiY1z+cPiw=; fh=hVXjHDAF1hvU+bvP/g1iAEYm4w+sHjhJINVZYWhQ5us=; b=TrBQWgFO1UZB4WfF4fAMtYuRQUD7S5Lynnbf8GIg/VgSd9TzXoVlVr498cDXIuOyn8 aLNLzJK/tjIxBVe8TDDpsuXmguyVX8SO+LjTk860Qg7kVYHh78Lv/xyFVmnuWU+MdHeL hT+LbLwZhO3hOeaXtRQOU4Nr42LTecPo0RnGcQMr8njRGb5C4KQayVyuBoZhsBC57agq vW6HhgXDeS+xOv05vkDjApmEZQ8Oa8q4Vot07ADD6jXOPxtgRuX8VQMFoZpThV8qdwzr aHEufBsiYSyo0NHNnOtyiF6hYHqI6LObH57v4pvoDLV4LauVzl27gl39r2/GbwBkLTbl 8lug==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; arc=pass (i=1 spf=pass spfdomain=iscas.ac.cn); spf=pass (google.com: domain of linux-kernel+bounces-108568-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-108568-linux.lists.archive=gmail.com@vger.kernel.org" Return-Path: Received: from am.mirrors.kernel.org (am.mirrors.kernel.org. [2604:1380:4601:e00::3]) by mx.google.com with ESMTPS id ws1-20020a170907704100b00a462a5a4948si5926787ejb.276.2024.03.20.00.47.07 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 20 Mar 2024 00:47:07 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-108568-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) client-ip=2604:1380:4601:e00::3; Authentication-Results: mx.google.com; arc=pass (i=1 spf=pass spfdomain=iscas.ac.cn); spf=pass (google.com: domain of linux-kernel+bounces-108568-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-108568-linux.lists.archive=gmail.com@vger.kernel.org" Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by am.mirrors.kernel.org (Postfix) with ESMTPS id 22BC21F23D2E for ; Wed, 20 Mar 2024 07:47:01 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 18F812BD1F; Wed, 20 Mar 2024 07:46:49 +0000 (UTC) Received: from cstnet.cn (smtp81.cstnet.cn [159.226.251.81]) (using TLSv1.2 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 7540D20DCC; Wed, 20 Mar 2024 07:46:43 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=159.226.251.81 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1710920808; cv=none; b=tw5PffJttBJ7Sn2j6OmYgy6NqciEhH8dowwrYiyo5vYmJ4aFFBGfceaPb1/o291HEX0CVehfBROPyVSqtfr37FuWUIA0O2OB6tqTy1lQB83jxcKpEJFqtWlSLmClgmbPKsyXwMofCzQtjEqIH4RfGyvOVa4XZVtOilHImIS8l18= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1710920808; c=relaxed/simple; bh=R8qWnT0pcFEIMIHAwgUqU6SjvSra2zMocjTcX/gqfSU=; h=From:To:Cc:Subject:Date:Message-Id:MIME-Version; b=WTKaP8KOtuShYbg6SiC/TsjWw4dHYLe63VR2U+AFybE5iavlAfYnxC/iJoWz18PbC3PlvXp4Rw3vtYFYPRbCPBeqSPP+UxTBkF90Nwobw3FtKjiDE+p4gcRZDcr5PrKmkHmzjCWKnlXYR1APwQeaO+7bjZ82bs6tssu/C9sbf1U= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=iscas.ac.cn; spf=pass smtp.mailfrom=iscas.ac.cn; arc=none smtp.client-ip=159.226.251.81 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=iscas.ac.cn Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=iscas.ac.cn Received: from localhost (unknown [124.16.138.129]) by APP-03 (Coremail) with SMTP id rQCowACHZwBdkvplsfItBw--.36178S2; Wed, 20 Mar 2024 15:38:06 +0800 (CST) From: Chen Ni To: davem@davemloft.net, edumazet@google.com, kuba@kernel.org, pabeni@redhat.com, grundler@chromium.org, christian.riesch@omicron.at, linux-usb@vger.kernel.org, netdev@vger.kernel.org, linux-kernel@vger.kernel.org Cc: Chen Ni Subject: [PATCH net] net: asix: Add check for usbnet_get_endpoints Date: Wed, 20 Mar 2024 07:37:15 +0000 Message-Id: <20240320073715.2002973-1-nichen@iscas.ac.cn> X-Mailer: git-send-email 2.25.1 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-CM-TRANSID:rQCowACHZwBdkvplsfItBw--.36178S2 X-Coremail-Antispam: 1UD129KBjvJXoW7tFy3AFyDGr1DXr18Aw1fWFg_yoW8Wry5pF 48Ga98tr48JrW8G3yDtw48urW5ZFn2qa42kF92kw1a9Fy3AF93Gr10kw1Yy3s29FWfXa4q yF4DGw4Yqr15WaUanT9S1TB71UUUUU7qnTZGkaVYY2UrUUUUjbIjqfuFe4nvWSU5nxnvy2 9KBjDU0xBIdaVrnRJUUUv014x267AKxVW8JVW5JwAFc2x0x2IEx4CE42xK8VAvwI8IcIk0 rVWrJVCq3wAFIxvE14AKwVWUJVWUGwA2ocxC64kIII0Yj41l84x0c7CEw4AK67xGY2AK02 1l84ACjcxK6xIIjxv20xvE14v26r4j6ryUM28EF7xvwVC0I7IYx2IY6xkF7I0E14v26r4j 6F4UM28EF7xvwVC2z280aVAFwI0_Gr1j6F4UJwA2z4x0Y4vEx4A2jsIEc7CjxVAFwI0_Cr 1j6rxdM2AIxVAIcxkEcVAq07x20xvEncxIr21l5I8CrVACY4xI64kE6c02F40Ex7xfMcIj 6xIIjxv20xvE14v26r1j6r18McIj6I8E87Iv67AKxVW8JVWxJwAm72CE4IkC6x0Yz7v_Jr 0_Gr1lF7xvr2IYc2Ij64vIr41lF7I21c0EjII2zVCS5cI20VAGYxC7M4IIrI8v6xkF7I0E 8cxan2IY04v7MxAIw28IcxkI7VAKI48JMxC20s026xCaFVCjc4AY6r1j6r4UMI8I3I0E5I 8CrVAFwI0_Jr0_Jr4lx2IqxVCjr7xvwVAFwI0_JrI_JrWlx4CE17CEb7AF67AKxVWUtVW8 ZwCIc40Y0x0EwIxGrwCI42IY6xIIjxv20xvE14v26r1j6r1xMIIF0xvE2Ix0cI8IcVCY1x 0267AKxVWUJVW8JwCI42IY6xAIw20EY4v20xvaj40_Jr0_JF4lIxAIcVC2z280aVAFwI0_ Jr0_Gr1lIxAIcVC2z280aVCY1x0267AKxVW8JVW8JrUvcSsGvfC2KfnxnUUI43ZEXa7VUb 0D73UUUUU== X-CM-SenderInfo: xqlfxv3q6l2u1dvotugofq/ Add check for usbnet_get_endpoints() and return the error if it fails in order to transfer the error. Fixes: b4cdae20ef95 ("asix: Rename asix.c to asix_devices.c") Signed-off-by: Chen Ni --- drivers/net/usb/asix_devices.c | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/drivers/net/usb/asix_devices.c b/drivers/net/usb/asix_devices.c index f7cff58fe044..4732a2951bf2 100644 --- a/drivers/net/usb/asix_devices.c +++ b/drivers/net/usb/asix_devices.c @@ -230,7 +230,9 @@ static int ax88172_bind(struct usbnet *dev, struct usb_interface *intf) int i; unsigned long gpio_bits = dev->driver_info->data; - usbnet_get_endpoints(dev,intf); + ret = usbnet_get_endpoints(dev, intf); + if (ret < 0) + goto out; /* Toggle the GPIOs in a manufacturer/model specific way */ for (i = 2; i >= 0; i--) { @@ -834,7 +836,9 @@ static int ax88772_bind(struct usbnet *dev, struct usb_interface *intf) dev->driver_priv = priv; - usbnet_get_endpoints(dev, intf); + ret = usbnet_get_endpoints(dev, intf); + if (ret < 0) + return ret; /* Maybe the boot loader passed the MAC address via device tree */ if (!eth_platform_get_mac_address(&dev->udev->dev, buf)) { @@ -1258,7 +1262,9 @@ static int ax88178_bind(struct usbnet *dev, struct usb_interface *intf) int ret; u8 buf[ETH_ALEN] = {0}; - usbnet_get_endpoints(dev,intf); + ret = usbnet_get_endpoints(dev, intf); + if (ret < 0) + return ret; /* Get the MAC address */ ret = asix_read_cmd(dev, AX_CMD_READ_NODE_ID, 0, 0, ETH_ALEN, buf, 0); -- 2.25.1