Received: by 2002:a05:7412:8d1c:b0:fa:4c10:6cad with SMTP id bj28csp282439rdb; Wed, 17 Jan 2024 01:32:07 -0800 (PST) X-Google-Smtp-Source: AGHT+IHhUdQOZrprQRcAmSNNNAc4HS9/xB+NuJMtWqk4SZkxPaJ1bp+UnQNHh/a/vsgDFqjEBp0W X-Received: by 2002:a17:906:cc13:b0:a27:d3ee:2ef5 with SMTP id ml19-20020a170906cc1300b00a27d3ee2ef5mr530063ejb.24.1705483927567; Wed, 17 Jan 2024 01:32:07 -0800 (PST) Return-Path: Received: from am.mirrors.kernel.org (am.mirrors.kernel.org. [2604:1380:4601:e00::3]) by mx.google.com with ESMTPS id l24-20020a170906a41800b00a2d06893ab2si4121196ejz.291.2024.01.17.01.32.07 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 17 Jan 2024 01:32:07 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-28719-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) client-ip=2604:1380:4601:e00::3; Authentication-Results: mx.google.com; dkim=pass header.i=@quicinc.com header.s=qcppdkim1 header.b=hsiikKnH; arc=fail (signature failed); spf=pass (google.com: domain of linux-kernel+bounces-28719-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-28719-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=quicinc.com Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by am.mirrors.kernel.org (Postfix) with ESMTPS id 14F521F273C9 for ; Wed, 17 Jan 2024 09:23:51 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id D5B5C1400B; Wed, 17 Jan 2024 09:22:42 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=quicinc.com header.i=@quicinc.com header.b="hsiikKnH" Received: from mx0b-0031df01.pphosted.com (mx0b-0031df01.pphosted.com [205.220.180.131]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id A7F29134C8; Wed, 17 Jan 2024 09:22:40 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=205.220.180.131 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1705483362; cv=none; b=GuiirdxB5OcugHKNcS+elAF5wSvI4XF53K4ItdhmBERUxjbhgs1fRcn6btm7kirLwHzh3GiaL5FeOs23OA05WhDVUS5HYCjMHXBMC+nrxrCSGmsPgkDWId9x4lacZ5JDo8lLLH5ugdvcfKZccjtnlXcmHd0KhOI4O8+mjhYu6cg= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1705483362; c=relaxed/simple; bh=8Hq12A3R9kvTLbQkGASmU/vU6L5V1gT75319YCZrdAA=; h=Received:DKIM-Signature:Received:Received:Received:Message-ID: Date:MIME-Version:User-Agent:Subject:Content-Language:To:CC: References:From:In-Reply-To:Content-Type:Content-Transfer-Encoding: X-Originating-IP:X-ClientProxiedBy:X-QCInternal: X-Proofpoint-Virus-Version:X-Proofpoint-GUID: X-Proofpoint-ORIG-GUID:X-Proofpoint-Virus-Version: X-Proofpoint-Spam-Details; b=GN07cMHkHcveypY3M3KaPblAn41i2LhkUqlh6Oo+EpxSzoHe9xas40SBUh8flLkK7Cszi1yOToperxN7F14WkZl5My9LBxF1XqigWd4P/NYshK4QK27npMSmFvvcSi/eI8zI0EIQus0jpvPdEpkKjPIIGnXxbaFIw7HmJwtOGpE= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=quicinc.com; spf=pass smtp.mailfrom=quicinc.com; dkim=pass (2048-bit key) header.d=quicinc.com header.i=@quicinc.com header.b=hsiikKnH; arc=none smtp.client-ip=205.220.180.131 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=quicinc.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=quicinc.com Received: from pps.filterd (m0279872.ppops.net [127.0.0.1]) by mx0a-0031df01.pphosted.com (8.17.1.24/8.17.1.24) with ESMTP id 40H3vZhu027266; Wed, 17 Jan 2024 09:22:37 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=quicinc.com; h= message-id:date:mime-version:subject:to:cc:references:from :in-reply-to:content-type:content-transfer-encoding; s= qcppdkim1; bh=8UyA6B+7jJ0WmY7unNvthyzBcl0PLj9aYF+nuReRk5s=; b=hs iikKnHFB1Jr9hsNvwVEsNmQ7vnDqxuzMu8eTX+3A5lVsDEI9qFVNEm5gVfpfNCg+ YHcO0/EHhNFu+nJA+9jgJQrBY3zQ5lMxMhw7/xdW7vjkNlJJvh3txX54xbQOD/q7 VtY02lg+u6GFNdULjidTk7y51GQukEoVMcRkD0EId0WIzX0QvlCPRvKEnu6scIDK CLio9bPNFRVcZKo0wHcs9yUnOWOdfGNlXGJ83JdUxG2Zb+Tl0JxebXYoTKcrUHby fuR6HmdRznQU7CTEuHNlf9ylM/HLBE/GnztFFYmHRO6tjG+DKmhXvq7waWRuB882 b4koe5Q0qf3wK+7IWIZg== Received: from nasanppmta02.qualcomm.com (i-global254.qualcomm.com [199.106.103.254]) by mx0a-0031df01.pphosted.com (PPS) with ESMTPS id 3vnq4t32tx-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Wed, 17 Jan 2024 09:22:36 +0000 (GMT) Received: from nasanex01a.na.qualcomm.com (nasanex01a.na.qualcomm.com [10.52.223.231]) by NASANPPMTA02.qualcomm.com (8.17.1.5/8.17.1.5) with ESMTPS id 40H9MK53028097 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Wed, 17 Jan 2024 09:22:20 GMT Received: from [10.218.39.189] (10.80.80.8) by nasanex01a.na.qualcomm.com (10.52.223.231) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.1118.40; Wed, 17 Jan 2024 01:22:18 -0800 Message-ID: <77ffee9a-cd77-6a09-10ee-bdf17bfca5ec@quicinc.com> Date: Wed, 17 Jan 2024 14:52:14 +0530 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:102.0) Gecko/20100101 Thunderbird/102.2.2 Subject: Re: [RFC PATCH] usb: dwc3: gadget: Fix NULL pointer dereference in dwc3_gadget_suspend Content-Language: en-US To: Kuen-Han Tsai CC: Thinh Nguyen , Greg Kroah-Hartman , , References: <20240110095532.4776-1-quic_uaggarwa@quicinc.com> From: UTTKARSH AGGARWAL In-Reply-To: Content-Type: text/plain; charset="UTF-8"; format=flowed Content-Transfer-Encoding: 8bit X-ClientProxiedBy: nasanex01a.na.qualcomm.com (10.52.223.231) To nasanex01a.na.qualcomm.com (10.52.223.231) X-QCInternal: smtphost X-Proofpoint-Virus-Version: vendor=nai engine=6200 definitions=5800 signatures=585085 X-Proofpoint-GUID: u5vagpAXOvoNFeoDLpn6a8j_lY6X_0HA X-Proofpoint-ORIG-GUID: u5vagpAXOvoNFeoDLpn6a8j_lY6X_0HA X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.272,Aquarius:18.0.997,Hydra:6.0.619,FMLib:17.11.176.26 definitions=2024-01-17_04,2024-01-16_01,2023-05-22_02 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 mlxscore=0 adultscore=0 clxscore=1011 malwarescore=0 suspectscore=0 spamscore=0 lowpriorityscore=0 bulkscore=0 mlxlogscore=470 priorityscore=1501 phishscore=0 impostorscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.19.0-2311290000 definitions=main-2401170065 On 1/17/2024 12:47 PM, Kuen-Han Tsai wrote: >> ret = dwc3_gadget_soft_disconnect(dwc); >> if (ret) >> goto err; > For improved readability, we can remove the goto statement and move > the error handling logic here. Hi Kuen-Han, Thanks for the suggestion. Does this looks good to you ?    int ret = dwc3_gadget_soft_disconnect(dwc);    if (ret) {        if (dwc->softconnect)            dwc3_gadget_soft_connect(dwc);        return ret;    }    spin_lock_irqsave(&dwc->lock, flags);    if (dwc->gadget_driver)        dwc3_disconnect_gadget(dwc);    spin_unlock_irqrestore(&dwc->lock, flags); Thanks, Uttkarsh