Received: by 2002:a05:6a10:f3d0:0:0:0:0 with SMTP id a16csp1151541pxv; Fri, 9 Jul 2021 19:40:08 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzmXPyyBD2OYO154wWWAL8/B2gosLdPeI7I2+ul7Zx0krdFBFk/xYuOWmHfeE4Mp4mpVj6y X-Received: by 2002:a05:6e02:18c9:: with SMTP id s9mr29374057ilu.220.1625884808637; Fri, 09 Jul 2021 19:40:08 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1625884808; cv=none; d=google.com; s=arc-20160816; b=RqnVZHOMU0f7zK5JQ6tAXrcAqFL2dUYSYM1xDe9n1j4mhrWnFqioF8EXqelrc36YvR YUwMXHqFZnZcElLwdZH8VhFjxTy0Y6pwqSi2aRam/hvSIXfkGy2JiaKSUGC+5TbkUbWo PRrB7y1JYFgi9aiM66cM6GFtsJrQDAzd1hNeRDRhKv9SfbI7FVgwaNrk4q9RfxI2YERL FRrjPNM01DccX+q5x0HFv/4wsgT7IIPXIWXZhj4zYu6orsG7a58gnOLOE+qGpGJRFBQX qBgXJ6GmrRHXM+GltE84IWZnIYbZGPiuayM6m+/ULQTVinmvycqb3jpGwosQeFY2jji5 QnWA== 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=INj5ojS3TiIUCqGqsWZBvUZMptJqO9jsA1GxNjbRjncA0XQOyCeU1HT9vClOqiBUl3 cEmY7XeUH8zGXR860b6AxkuuMEdtgnOCBHbCZr4lMVxyGFVUNb5qvWb2dfqSX6ObpN04 CPUj496zXA+V4MFqE2v6U8t3v6OHkyapKVi6DHflkXoSi9K7HSyjZOHFRFgXx2vaZejS fKbgnfMNr3ybcp30dguga0Xp0nVKUvHxhO32oVi4IaxxtxwnfjEwZL0h0nhmP3qBF3n3 qHC0SHB8bMLaMJqS5+m5X0JHV4zug/8fyrL2UAGnbjP6e97mAhRMxFAjTPerTFE5kqsx 3GPQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b="e3CXkl/a"; 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 e6si8596230ilm.61.2021.07.09.19.39.56; Fri, 09 Jul 2021 19:40:08 -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="e3CXkl/a"; 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 S233600AbhGJCmI (ORCPT + 99 others); Fri, 9 Jul 2021 22:42:08 -0400 Received: from mail.kernel.org ([198.145.29.99]:58364 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234878AbhGJCjR (ORCPT ); Fri, 9 Jul 2021 22:39:17 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id 0545D613D3; Sat, 10 Jul 2021 02:35:02 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1625884503; bh=+cUaXs9SZyH/ZrXGu4wPjqlTNqEvKvvC7K1OSUMyATE=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=e3CXkl/a+AaLsc1+z0Vn2XTsuLYsdlYuOt8eXaREThBYLsnmTyeuazvsLTO/jXkKA IFQfaT9ux1dA7qqZEr+SUssmjN7A5063VjlioVDGfnHikPkjMqfmcF4ecySsIDcAZm CGKde1vCrqkZhzolfrGayiygeI2rxpxn6tZUAAm/ecW7L1LdQI+Ky5JfSEmtdH/deY j3su/UMeaogN8d+XpOpugl/H67hX223LCZR7B3cjICQRv2xjePR+e4dKK6Idoa3z7m MgxffyiWvWPAR74Do84z5xaCKUeIb98auaGWpC/rpVatciI9o9AeyuBfimCyDheLvb ogjunP6NE3ezQ== 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 4.19 31/39] usb: gadget: hid: fix error return code in hid_bind() Date: Fri, 9 Jul 2021 22:31:56 -0400 Message-Id: <20210710023204.3171428-31-sashal@kernel.org> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20210710023204.3171428-1-sashal@kernel.org> References: <20210710023204.3171428-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