Received: by 2002:a05:6a10:f347:0:0:0:0 with SMTP id d7csp9125280pxu; Mon, 28 Dec 2020 07:14:30 -0800 (PST) X-Google-Smtp-Source: ABdhPJxBmrlzogGUVH8qhmAr093rHOhNGAa8iaqxTDOAcgo17ly6gsGPBUg5kVUQVOMc3jzPtGAP X-Received: by 2002:a17:906:af79:: with SMTP id os25mr41908875ejb.275.1609168470330; Mon, 28 Dec 2020 07:14:30 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1609168470; cv=none; d=google.com; s=arc-20160816; b=k6zK1+tV/WB2eT/ck2Us+cuHMC4F6dIw/LgO/ZXbWrtxcKl7H7kFCv12nIirv784XH 0fAOZBcp8LI16+gpOD4e7IqwDNvnurtqWKBsybrmo7oS6SKenj90i0qPR++ATh0+w7gm Nys+V8ErnZIkbQZ0slkFOhokAtm4UCJXjTGVKiIdFvy6RIjplj2WDplg7NHRued9PZEF Aaunbtk3LoL2EU6ohje96Lz9kqxPDqMa6A1cLgWIX0eVeO2tSbVmWf0oVxSHtCGicuHc QcX/m8d1NQRNkJDxNHc7794XQC8FrlywcryFQMN2aLyNiTTn9zimmttAK7c/u+NJJMdc LlnQ== 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 :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=uHR+AfXjQ2aCr8L4yW/HOvDMxNiOHZSkipS8QwtH+Eg=; b=o8YHmp5T1w4Nzh/XK5obwnEGon+OHzyeV6Np7uySDqyrqpKeZKfOXfG0cwKMAkJPNc MkmDHtQKpY1eGHFuHtK+e1Fe98hWIvRspMRK07pAT3YM2BSuaoekXPM85mOsU/NCJdgQ 7EVCoaapGTVpdsNhyDm5pLVeOkThQF8raD5t8Ujy5q0WHV0V8vOAviSxYiCdMyLF3IGF Xcl9GQLYAtOn/lisKacGxP7W6QslufrH9FyiiZfi/TZyySowH+OlJXpRwIpjMrkK6Og3 wKehxPQGyvAqhXvougGguOOL/qP0CllN35pSH6NmrXmWnmWONQ3j+cdSp2ehCYRR+mWN O5eg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=1dPyqd3O; 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=linuxfoundation.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id a15si20632223eda.177.2020.12.28.07.14.06; Mon, 28 Dec 2020 07:14:30 -0800 (PST) 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=@linuxfoundation.org header.s=korg header.b=1dPyqd3O; 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=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2438373AbgL1OHO (ORCPT + 99 others); Mon, 28 Dec 2020 09:07:14 -0500 Received: from mail.kernel.org ([198.145.29.99]:40464 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2437815AbgL1OGL (ORCPT ); Mon, 28 Dec 2020 09:06:11 -0500 Received: by mail.kernel.org (Postfix) with ESMTPSA id 254E722B45; Mon, 28 Dec 2020 14:05:54 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1609164355; bh=j46StAFyhEDQgEQK2MouMzDAFqYogRt0xNVqxWIRz/M=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=1dPyqd3O2h/F47p7QOVhlZ7O//yLT/Zwmo0jgmOlzsVkuFEXSIhsa3fppcHzA6vdy K/lRIQB10/ZGJkG7/Wv3WVQMz2+bS3L+3cW89/V5d59DsdL/bk+LAFGjYId+HInJsK uP4e1NWuPmwocRZQCbjc44nmukv/KYW8ee3g/7aw= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Hulk Robot , Yang Yingliang , Sasha Levin Subject: [PATCH 5.10 152/717] usb/max3421: fix return error code in max3421_probe() Date: Mon, 28 Dec 2020 13:42:30 +0100 Message-Id: <20201228125028.240770332@linuxfoundation.org> X-Mailer: git-send-email 2.29.2 In-Reply-To: <20201228125020.963311703@linuxfoundation.org> References: <20201228125020.963311703@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Yang Yingliang [ Upstream commit 5a569343e8a618dc73edebe0957eb42f2ab476bd ] retval may be reassigned to 0 after max3421_of_vbus_en_pin(), if allocate memory failed after this, max3421_probe() cann't return ENOMEM, fix this by moving assign retval afther max3421_probe(). Fixes: 721fdc83b31b ("usb: max3421: Add devicetree support") Reported-by: Hulk Robot Signed-off-by: Yang Yingliang Link: https://lore.kernel.org/r/20201117061500.3454223-1-yangyingliang@huawei.com Signed-off-by: Greg Kroah-Hartman Signed-off-by: Sasha Levin --- drivers/usb/host/max3421-hcd.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/drivers/usb/host/max3421-hcd.c b/drivers/usb/host/max3421-hcd.c index 0894f6caccb2c..ebb8180b52ab1 100644 --- a/drivers/usb/host/max3421-hcd.c +++ b/drivers/usb/host/max3421-hcd.c @@ -1847,7 +1847,7 @@ max3421_probe(struct spi_device *spi) struct max3421_hcd *max3421_hcd; struct usb_hcd *hcd = NULL; struct max3421_hcd_platform_data *pdata = NULL; - int retval = -ENOMEM; + int retval; if (spi_setup(spi) < 0) { dev_err(&spi->dev, "Unable to setup SPI bus"); @@ -1889,6 +1889,7 @@ max3421_probe(struct spi_device *spi) goto error; } + retval = -ENOMEM; hcd = usb_create_hcd(&max3421_hcd_desc, &spi->dev, dev_name(&spi->dev)); if (!hcd) { -- 2.27.0