Received: by 2002:a05:6a10:16a7:0:0:0:0 with SMTP id gp39csp342804pxb; Thu, 12 Nov 2020 05:25:38 -0800 (PST) X-Google-Smtp-Source: ABdhPJyOEsEckZeBtOUhzEXK5ljVCKeHe2q4ZIAyI3syUfLZrPBITHrzIlP+kcUI+xiV2fnRqHj9 X-Received: by 2002:a05:6402:14c6:: with SMTP id f6mr5224409edx.359.1605187538195; Thu, 12 Nov 2020 05:25:38 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1605187538; cv=none; d=google.com; s=arc-20160816; b=LvPQ+pTLR6PmAfuXeriB/UoZmFyFOoUp6PtpxI7DF+ksbTYS3VBiAlc/zesqjMVniL u7Jf8kzUuJAz7sMJ/B0iEQ86x1SEcxlQlwOlfyIcAekQ8MO1+7exbmi8aB4ZP5xSL4TD oFH1/PiQf0duFgEXPeyVIuo+xOnVmxqv0mpcB68HyvACFQPfnGHNY1xm1/SRdlXXwQgQ +M3aaC9fQZCu1Ko+jLSqQ/uG4obQ6owbpmfSLBRekNG6WfPOKnCZCuf6i7pEOmA4rwyK 6HcSJk84yJTL/dJYtSJrPgbG1191lFagb7JIOSWewOJAr0Q8E+Wkhoeuzg/BXrf2JtCH AOeQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:in-reply-to :mime-version:user-agent:date:message-id:from:cc:references:to :subject; bh=NGdYsRTgb7b2j+K7t+xueiPu4YuvwtmSHmyGm+FDxxY=; b=nCuytXGLIii3yV26VpUxWcQvWnw8+PBJeMXJK1PsYFtms3OudD8GiWeVdV+1v8Baez xs2DqBXKfGyjaZr/A5tJ9ssXBWjJPWVgtYr+xbd3wbsdINwNYa2UBAp87QKkEejnd3KB sB3iXg9PVijQ8+dSccUZBz6SlAwYWP1H1KA85bh6hVI4OPtTCtPwEUfq8FOeT9YUnFQf HCUDMjTuSB0629C0it11hUGmu0TAshWEU5cDhzpSzuh5+SYvWO0H8UluQ1Qa8rG9GGUa o5Vqb3rIiiHE+8XjM/nMKVDrknVjzsY1vQ3xWM0WYlBSkldNpk+WE6pCwgBugKLRokWM 06SQ== ARC-Authentication-Results: i=1; mx.google.com; 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id q10si3375268ejn.234.2020.11.12.05.25.15; Thu, 12 Nov 2020 05:25:38 -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; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728305AbgKLNXT (ORCPT + 99 others); Thu, 12 Nov 2020 08:23:19 -0500 Received: from szxga05-in.huawei.com ([45.249.212.191]:7523 "EHLO szxga05-in.huawei.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728266AbgKLNXS (ORCPT ); Thu, 12 Nov 2020 08:23:18 -0500 Received: from DGGEMS405-HUB.china.huawei.com (unknown [172.30.72.58]) by szxga05-in.huawei.com (SkyGuard) with ESMTP id 4CX2N91FKvzhk1l; Thu, 12 Nov 2020 21:23:05 +0800 (CST) Received: from [10.174.176.61] (10.174.176.61) by DGGEMS405-HUB.china.huawei.com (10.3.19.205) with Microsoft SMTP Server id 14.3.487.0; Thu, 12 Nov 2020 21:23:05 +0800 Subject: Re: [PATCH] usb: gadget: mass_storage: fix error return code in msg_bind() To: References: <20201112085324.181903-1-chenzhou10@huawei.com> CC: , , , , , , Hulk Robot From: chenzhou Message-ID: <53ee397a-ef2e-4248-8d32-52c8d1e138e9@huawei.com> Date: Thu, 12 Nov 2020 21:23:04 +0800 User-Agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:45.0) Gecko/20100101 Thunderbird/45.7.1 MIME-Version: 1.0 In-Reply-To: <20201112085324.181903-1-chenzhou10@huawei.com> Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 7bit X-Originating-IP: [10.174.176.61] X-CFilter-Loop: Reflected Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 2020/11/12 16:53, Chen Zhou wrote: > Fix to return a negative error code from the error handling case > instead of 0 in function msg_bind(), as done elsewhere in this > function. > > Fixes: d86788979761 ("usb: gadget: mass_storage: allocate and init otg descriptor by otg capabilities") > Reported-by: Hulk Robot > Signed-off-by: Chen Zhou > --- > drivers/usb/gadget/legacy/mass_storage.c | 4 +++- > 1 file changed, 3 insertions(+), 1 deletion(-) > > diff --git a/drivers/usb/gadget/legacy/mass_storage.c b/drivers/usb/gadget/legacy/mass_storage.c > index 9ed22c5fb7fe..7a88c5282d61 100644 > --- a/drivers/usb/gadget/legacy/mass_storage.c > +++ b/drivers/usb/gadget/legacy/mass_storage.c > @@ -175,8 +175,10 @@ static int msg_bind(struct usb_composite_dev *cdev) > struct usb_descriptor_header *usb_desc; > > usb_desc = usb_otg_descriptor_alloc(cdev->gadget); > - if (!usb_desc) > + if (IS_ERR(usb_desc)) { > + status = PTR_ERR(usb_desc); > goto fail_string_ids; > + } > usb_otg_descriptor_init(cdev->gadget, usb_desc); > otg_desc[0] = usb_desc; > otg_desc[1] = NULL; Ignore this.