From nobody Sun Feb 8 02:40:10 2026 Received: from mail-wm1-f43.google.com (mail-wm1-f43.google.com [209.85.128.43]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 0A1721FF1A5 for ; Wed, 8 Jan 2025 17:06:00 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.128.43 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1736355962; cv=none; b=PpxVVCh9kaDNO4pn21NkenJ/DxRAC8Kc3prFtVC8OPqvKGeV0J9nFYEL+WE7kjHqljSAfbxsH5lHjkL4f7UVD1TvTlcOHup/KUd7QtSasTx6F4f+/3YUR9yWdEvtb3BEv94o61wiZI+D6033pTkXzRYMp0JUqiFJRo7pFPyO/Ko= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1736355962; c=relaxed/simple; bh=OI68onKi6KoJtopdFkSsGF2khOUuq6xNaRWnaWzYi6g=; h=From:To:Cc:Subject:Date:Message-ID:MIME-Version; b=QEaVVv/FUbwoOKKF8f4ziq+jGOLd+tA/QQwr2LK3HEY4o26VWEnWtCid/g7g17J4SWKG39D4y/Bm+cOwO/j2Q/ZuTYDW1q0uXVxkg3Toi27P3EhzfRiXsPzwfbbDSsBnWVLw4AXfQTfCk59TVv54lFUWn58IfjNDTUUWBqYUC5Q= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=InDhyjrR; arc=none smtp.client-ip=209.85.128.43 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="InDhyjrR" Received: by mail-wm1-f43.google.com with SMTP id 5b1f17b1804b1-43625c4a50dso628295e9.0 for ; Wed, 08 Jan 2025 09:06:00 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1736355959; x=1736960759; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:from:to:cc:subject:date:message-id:reply-to; bh=XLNrcx9cjynqqzuzB4NpWA0HHiIsSv6AxtzMCkQZk1s=; b=InDhyjrRcnuC7xGhMa1weUerb1UkPZAfewcc1ZOj9TxKhyr7phBRl7RG8er+hFBfky OXCGsGseyh76kl4WIKzD1oPkJSjNAqvmUN5max1V4CQ7Y3m/cwD4jHTUsrgLY7yVz4P5 IJ+GJ1V504kmoBLUN1WrG0iNOLeUw4eUt/f6myMGwrzXDnPedA9U0/GEXej375axxyRo doStIiHEFCTEBBUoIemktrPaOf2VYXASInzWDFK5OJMeMiywDkGT391YeaRhJ/J2KVgT CHZJHdcpUwIx/1C6jL/F4qA9pAb7rtcBA5iBWMSPE7EBFTJm0ScwKO/2ZYYwnoioOhY2 +kZQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1736355959; x=1736960759; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=XLNrcx9cjynqqzuzB4NpWA0HHiIsSv6AxtzMCkQZk1s=; b=lTP96zCviuuRAEW3+9xQ4MGLKef0YFatXNDpyu/uC2Zxa9QYefWCg4RTB7r7IT8ouN 5sUpIUlYgMBplY5n1oo1l5NpQoonASsVVHTWRoyrS6zdxsHqBGIvKSaWmPf/r0H+Ll40 Q3KOhMqbJk35AToo2mOZaVDpvMcxzXmBHjNBsf2m046OyHh2oObShAaEZPo+hZAsbxmE yjz/98kUJ/zD/R94Iq8EPXqc3H9hKE1zANJN3m8Dr+7LzuBi4T6SJhwQPjMOaBcLpdeR 3W/TNiABH/y6B1xapuMkE42wEZ7pR9Plqrf52jMLNmKaRW7L2o1kOnqfgoyKQCrLcwU3 Ay/A== X-Forwarded-Encrypted: i=1; AJvYcCUbUE4/GvejnaftUGRqBvK6QXb5LbTmkZHyjZ+ygT6L0UfkTIMi+O1vb8zZh1mPqiReaRDrmMREJ1fH4CI=@vger.kernel.org X-Gm-Message-State: AOJu0Yz5Q91HlI3j8lLyrdjFLXwB3WMl1Avch1xDXXikU6FuelHWbBuO 4UMbi7lut9TAfkog/ACGhyoeH+GxHNAX1GdUgPNLb9Gq0U595lZc X-Gm-Gg: ASbGncvEXSlxdmjCxLuZqLhgURM3bHP1ueBYkfrgIjjDL/l6PCho4c5D2ugjvO4OaQl hKMQeTc0/N+vjGU0OrvyBeQWGekEKhWk4qCpOF9flUYVIwtuZwtIIiW2DEBI9NkSBrOSxe0nnUr 5xkG2auChLwjxfhXGfMTJYoZxMx30X15tyhvyISnOgp4BVqZxsMtx2DmbYuHIJnS6pVx4wme+ms LvH5qeK5iHO57RUq9ldv1FCstye2NzpvlnnfGRgg4IlfdAZKgC/rk9lms8zo5cCVdV/49XkbZZM QBZmplMw1xPIHEHv X-Google-Smtp-Source: AGHT+IH2sB4x7lCWKBKIy07UrH/e0Eck9bmWFY4AOJGGv4IRCBbJ4OUaDYRnBvU/tjBGaVruFC9+NA== X-Received: by 2002:a05:6000:1566:b0:385:f1f2:13f1 with SMTP id ffacd0b85a97d-38a87303e62mr2847892f8f.22.1736355959222; Wed, 08 Jan 2025 09:05:59 -0800 (PST) Received: from localhost.localdomain (82-64-73-52.subs.proxad.net. [82.64.73.52]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-436e2da79c0sm27243965e9.6.2025.01.08.09.05.58 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 08 Jan 2025 09:05:58 -0800 (PST) From: Dave Penkler To: gregkh@linuxfoundation.org, linux-staging@lists.linux.dev, linux-kernel@vger.kernel.org Cc: Dave Penkler , kernel test robot , Dan Carpenter Subject: [PATCH] Add missing mutex unlock on early return in ni usb driver Date: Wed, 8 Jan 2025 18:05:47 +0100 Message-ID: <20250108170547.21871-1-dpenkler@gmail.com> X-Mailer: git-send-email 2.47.1 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" When the buffer allocation for return data in ni_usb_write() fails we were returning without unlocking the addressed_transfer_lock. Add the unlock call. This was detected by smatch: New smatch warnings: drivers/staging/gpib/ni_usb/ni_usb_gpib.c:837 ni_usb_write() warn: inconsis= tent returns '&ni_priv->addressed_transfer_lock'. Reported-by: kernel test robot Reported-by: Dan Carpenter Closes: https://lore.kernel.org/r/202412201550.9NCO57Ye-lkp@intel.com/ Signed-off-by: Dave Penkler --- drivers/staging/gpib/ni_usb/ni_usb_gpib.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/drivers/staging/gpib/ni_usb/ni_usb_gpib.c b/drivers/staging/gp= ib/ni_usb/ni_usb_gpib.c index 2c0a0d7e36c6..d0656dc520f5 100644 --- a/drivers/staging/gpib/ni_usb/ni_usb_gpib.c +++ b/drivers/staging/gpib/ni_usb/ni_usb_gpib.c @@ -783,8 +783,10 @@ static int ni_usb_write(gpib_board_t *board, uint8_t *= buffer, size_t length, } =20 in_data =3D kmalloc(in_data_length, GFP_KERNEL); - if (!in_data) + if (!in_data) { + mutex_unlock(&ni_priv->addressed_transfer_lock); return -ENOMEM; + } retval =3D ni_usb_receive_bulk_msg(ni_priv, in_data, in_data_length, &usb= _bytes_read, ni_usb_timeout_msecs(board->usec_timeout), 1); =20 --=20 2.47.1