Received: by 2002:a05:6a10:f3d0:0:0:0:0 with SMTP id a16csp1148507pxv; Fri, 9 Jul 2021 19:33:44 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzoHqk75pghb2OPlM0kOcHyY/JrCh2uxP7qPbjlIvg3uOmZJdUou8zfgw5vNR+44IihJMeY X-Received: by 2002:a17:906:614f:: with SMTP id p15mr16900295ejl.327.1625884424052; Fri, 09 Jul 2021 19:33:44 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1625884424; cv=none; d=google.com; s=arc-20160816; b=I8wleyWtDeMPHnatyluF4+4vo4sagtR7P8mrP5GK+LIBELDUQiteTcwb4AQVnjZppX 999rwjRvVpp76bA3zrlYdo0bD0V9x6I5f8t0OZERlmdG54mJoaFKon72YasA6MoA1jM8 P7Au/SFPH8H5dtMUoXV5dGR4tAd5kdw5OJFeRv96rz35HW1RyZMOvHZDWQ/QY7YWG6EO QOhtyId62bNg44wv/PbEUAy4VR/ZPBRlTpIuuYtPMllZ+0fWbgq9rb1TNwNYsAintA5/ H3YVvGbwguvTWMTnmQgjcXX3VWC8EBYM8hEM94veV2xXuNSA4R/utt9dZ3Dl/NLZeeiD 0o+g== 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 :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=kOk7bypCoBLNOEoqohKAiCTEIqEBTpPXTyPXpYWY8Jw=; b=st+6Dv2SWaoR+kniw6iLHk6Vugbf5E0Uv8Fr0bhQlXi+cLav/BSu3n0ESeiX75FUNa 2hytKcRZrhQnktu2/m0I1fKJsHlwKHMbs6vLy9YmExjxBX5U8QNAwJajlHo7mQzEtviI dYZS+Zac+VUB832D7eOG21NdWKCnemX+wdg0UPeHteIAGtDTkKzbELAOMTTUMPLO//A3 BwmBvRN4Hyexrs0+lGAAEZwwWdH+TUfthZzILXroDzsDDzPLDQe7Uy3BkqBwTDHctsf3 93jDVN0999c/i2Zzs0qRAG756KBXjwi1B5A4ly1B4YOlYgf2of7fqSy+kEUG5eM0V7vq jrEA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=M6ebIJ4T; 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=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id dm19si8738750ejc.143.2021.07.09.19.33.21; Fri, 09 Jul 2021 19:33:44 -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=@kernel.org header.s=k20201202 header.b=M6ebIJ4T; 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=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234709AbhGJCeI (ORCPT + 99 others); Fri, 9 Jul 2021 22:34:08 -0400 Received: from mail.kernel.org ([198.145.29.99]:42882 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234566AbhGJC3g (ORCPT ); Fri, 9 Jul 2021 22:29:36 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id CB001613E8; Sat, 10 Jul 2021 02:26:44 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1625884005; bh=+cUaXs9SZyH/ZrXGu4wPjqlTNqEvKvvC7K1OSUMyATE=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=M6ebIJ4Th84aKCEqubNx/uVf9jBcw0yy/OlCYFsFEgeuFy6L15lq4Conw2rV1Wmhs AomDhHdj9Dkl7eD+nfdejwhzB1F1j/KsgvYpSgMleXmUH2WaVCk33/kRIlHvN+eFa4 a2QeXbygNa1OOD/8L8eb1WxUcftI7IKKti58lYQ2XLB0dWbMJCNtmPbUnuzDQQMjQC s+U1934ztQlTOsyqpqYMPDmQ5s/O28p2+evoHnzs8/Zp3oI2O4cCr7xPto5xrgiKj5 uSFri9GYO34pNbtip6eUJJFCG6q8+CHg1EYqoES8FHqKDvwgUm+OOBw+Mj3Qgur9Bi wmbzkE4e5gK/Q== From: Sasha Levin To: linux-kernel@vger.kernel.org, stable@vger.kernel.org Cc: Yang Yingliang , Hulk Robot , Greg Kroah-Hartman , Sasha Levin , linux-usb@vger.kernel.org Subject: [PATCH AUTOSEL 5.10 79/93] usb: gadget: hid: fix error return code in hid_bind() Date: Fri, 9 Jul 2021 22:24:13 -0400 Message-Id: <20210710022428.3169839-79-sashal@kernel.org> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20210710022428.3169839-1-sashal@kernel.org> References: <20210710022428.3169839-1-sashal@kernel.org> MIME-Version: 1.0 X-stable: review X-Patchwork-Hint: Ignore Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Yang Yingliang [ Upstream commit 88693f770bb09c196b1eb5f06a484a254ecb9924 ] Fix to return a negative error code from the error handling case instead of 0. Reported-by: Hulk Robot Signed-off-by: Yang Yingliang Link: https://lore.kernel.org/r/20210618043835.2641360-1-yangyingliang@huawei.com Signed-off-by: Greg Kroah-Hartman Signed-off-by: Sasha Levin --- drivers/usb/gadget/legacy/hid.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/drivers/usb/gadget/legacy/hid.c b/drivers/usb/gadget/legacy/hid.c index c4eda7fe7ab4..5b27d289443f 100644 --- a/drivers/usb/gadget/legacy/hid.c +++ b/drivers/usb/gadget/legacy/hid.c @@ -171,8 +171,10 @@ static int hid_bind(struct usb_composite_dev *cdev) struct usb_descriptor_header *usb_desc; usb_desc = usb_otg_descriptor_alloc(gadget); - if (!usb_desc) + if (!usb_desc) { + status = -ENOMEM; goto put; + } usb_otg_descriptor_init(gadget, usb_desc); otg_desc[0] = usb_desc; otg_desc[1] = NULL; -- 2.30.2