Received: by 2002:a05:6a10:f3d0:0:0:0:0 with SMTP id a16csp1146487pxv; Fri, 9 Jul 2021 19:29:37 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxtOHeNkpDBdEtKMuTyza5LDXzCmWJcXvY1lVJvvbQKo584HGK0JGvjdlZZpnaFNFPd6Gp/ X-Received: by 2002:a17:906:b204:: with SMTP id p4mr12775485ejz.239.1625884177184; Fri, 09 Jul 2021 19:29:37 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1625884177; cv=none; d=google.com; s=arc-20160816; b=ejRGaOISrGw+QpHsT/GSXXb457YIeTLBK8WPKHoD/LgnEa41MA9z2jmqx6Eq3clTTN Xcshe7/RxHNFYN+QFWYRhEJNeZQjQNdxKHjlAMY38kIzYi0n5VDTSmU166tZbMg0qoHl W8o8sRTmu6Rkvhwd3LOYZO8PfKRCnNlUQF1BccedCjdpiSCNw6UYJXAqNziEeb77bMJz BolN+9KjDFTCpcfqiuVkFnqLWpe1KpoT/UELd3MRejet6tRqCj91YzUhc47Du6M3F+g0 F048ioq1ypOVl+Kj6soGZRg6TUr9FqT4USexqKCe6GBRccQ9gfxrvrQs62dxA60Y+HZe IiHQ== 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=uDtYNAqyH1v6MkSoYPK+xMYNSjtkSLDLm1d2UMOHgtZNpIcLup6SFXuB/Wfjvrn1iL PID6UIj6veyieQwAQAfrxvohoBA8KwLSxu+fMGqaDFwvHargXuPJwIDVmm94mjj1sv5Q PUIH7rdxMata8GkkaxV3Bo1Zy+GlnjeAwOBe851FWcDYnDISiRt+j5zHrR5Z8dE0Kq1B nl79cO70hox3+dX+Po3K+HwALR/n3hVOW83RFgfGLPpiY3IqAWEWtSOGcSeV+hlVVhGA VIkUrNKErw5zpLIIGtq5LpiC4n+a6rvDSUkfakbDo5/Cq6qBIrOopBBxSserABRG4JVz PT+Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=Quaq7QrB; 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 du14si9360523ejc.439.2021.07.09.19.29.14; Fri, 09 Jul 2021 19:29:37 -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=Quaq7QrB; 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 S233819AbhGJC2f (ORCPT + 99 others); Fri, 9 Jul 2021 22:28:35 -0400 Received: from mail.kernel.org ([198.145.29.99]:42484 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233156AbhGJC04 (ORCPT ); Fri, 9 Jul 2021 22:26:56 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id 8612D6140A; Sat, 10 Jul 2021 02:24:03 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1625883844; bh=+cUaXs9SZyH/ZrXGu4wPjqlTNqEvKvvC7K1OSUMyATE=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Quaq7QrB80TJlFKvLbYlr7aGZ+FEOoEH9YI41CtqgKf9UR15xyx1Cyq0deYeqBT3c MsGuOgHvVOUIfu9o/jdfBHJQo3wQiq0ZOs9Y3JMixoeUCO7RJKs4pURBGT06lBMuPc LTHAVbgF9Z1r5KvcfP7Bk/yNWuuz9mjWAn7UkxMhruTex8B+j+GNWZYwnFMmlTj89R Ex68Y7IKZFAUkJQ4PzdfsdOsANsDxzik6gJitWW4rLOtxbXTLta9yeC6huZYkkd2Jd hcwoFSISTL9BMw3WvyMsaA6gKxXaroETZpT8uAYm4m7vpYu3ZD53auKQrSaiDfArAl W/aEZjQiAHg9Q== 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.12 089/104] usb: gadget: hid: fix error return code in hid_bind() Date: Fri, 9 Jul 2021 22:21:41 -0400 Message-Id: <20210710022156.3168825-89-sashal@kernel.org> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20210710022156.3168825-1-sashal@kernel.org> References: <20210710022156.3168825-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