linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Zqiang <qiang.zhang@linux.dev>
To: oneukum@suse.com, kuba@kernel.org, andrew+netdev@lunn.ch,
	davem@davemloft.net, pabeni@redhat.com
Cc: qiang.zhang@linux.dev, netdev@vger.kernel.org,
	linux-kernel@vger.kernel.org
Subject: [PATCH] net: usb: Make init_satus() return -ENOMEM if alloc failed
Date: Wed, 16 Jul 2025 08:15:23 +0800	[thread overview]
Message-ID: <20250716001524.168110-1-qiang.zhang@linux.dev> (raw)

This commit make init_status() return -ENOMEM, if invoke
kmalloc() return failed.

Signed-off-by: Zqiang <qiang.zhang@linux.dev>
---
 drivers/net/usb/usbnet.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/drivers/net/usb/usbnet.c b/drivers/net/usb/usbnet.c
index 921c05bc73e3..26fce452581c 100644
--- a/drivers/net/usb/usbnet.c
+++ b/drivers/net/usb/usbnet.c
@@ -254,6 +254,8 @@ static int init_status (struct usbnet *dev, struct usb_interface *intf)
 				"status ep%din, %d bytes period %d\n",
 				usb_pipeendpoint(pipe), maxp, period);
 		}
+	} else {
+		return -ENOMEM;
 	}
 	return 0;
 }
-- 
2.48.1


             reply	other threads:[~2025-07-16  0:15 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-07-16  0:15 Zqiang [this message]
2025-07-16  0:15 ` [PATCH] net: usb: Remove duplicate assignments for net->pcpu_stat_type Zqiang
2025-07-16  9:19   ` Simon Horman
2025-07-16 22:11   ` Jakub Kicinski
2025-07-17  0:08     ` qiang.zhang
2025-07-21  9:50   ` patchwork-bot+netdevbpf
2025-07-16  9:18 ` [PATCH] net: usb: Make init_satus() return -ENOMEM if alloc failed Simon Horman
2025-07-17  0:04   ` qiang.zhang

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20250716001524.168110-1-qiang.zhang@linux.dev \
    --to=qiang.zhang@linux.dev \
    --cc=andrew+netdev@lunn.ch \
    --cc=davem@davemloft.net \
    --cc=kuba@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=netdev@vger.kernel.org \
    --cc=oneukum@suse.com \
    --cc=pabeni@redhat.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).