Received: by 2002:a05:7412:bbc7:b0:fc:a2b0:25d7 with SMTP id kh7csp1097262rdb; Fri, 2 Feb 2024 13:38:40 -0800 (PST) X-Google-Smtp-Source: AGHT+IGEIHIRmp4LPM8KMociiEp1gsyIihtNaun1lyAUeBRBfw+NuR+dxqM9PgsEr1jwG2bPtZzE X-Received: by 2002:a17:906:dfcb:b0:a36:32d1:5140 with SMTP id jt11-20020a170906dfcb00b00a3632d15140mr6831528ejc.16.1706909920332; Fri, 02 Feb 2024 13:38:40 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1706909920; cv=pass; d=google.com; s=arc-20160816; b=got0f4qgzNetWERh09p4jbNq0EifMLVhWS8d3Kq5VDCoeyfos/7EMx2f0T4E4WRpAj mLYpzgKNDgy4iCFqA0FKIXgfXHU5P2GLyNc0FZ2Ls+6law3e/DrhvkICf2oawWHoTHfY iPVXwiccYUPGcLWsqodd44zjrYczgklC/a/nFjzgzOxE5JYfM1mvtZvD/DcsBIly/uzJ ZslKhiBcD3sumZ7BVb/4BCqKSSkc6gt+9XSgRoZffjNhF8YUYLMdryVbXjD0/4BHoWyp 8c28A8j4MTtABfOqEQxY4G6SfA+Be8H4Xdo1xRFPD03psaGsmvx3niTNLFk9gaqaK+3L 7vwQ== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:in-reply-to:from:references:cc:to :content-language:subject:user-agent:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:date:message-id:dkim-signature; bh=ldFHZ0O8cBXpgd6zgNxpsJBeusJDBKoGQUskWZPAlbg=; fh=AlvxCBO96W53Vz9NMdf1QX3W9gm2UHmMgeSXct1quPg=; b=FKv+pIl40J5cbhNk+po+i3Ul3QnldZF7mEnbx43DaZQnscjNz1Jh3kyMyER0FaZPEx agfK6uL5llNBysG6ADtwwncFFaQ8jvn1yq+qbwfE6MK+aD1u3jlsWanM627sGHSKn8hh AVbPl3GaWZYMVghM0w8+4UbDXZ6coE20GvdzdaqTJw2bvxBikYBkhfZYQLyTdb+v/wXi J+HwM4bAjAGvzPAINIGUsL0Fzf7BSM4ZgiZ+hdVIYYBOPssmqLqJdZSDS5INR98DmqQd fufU7LbTNyxTZ7GYutsXxg6g86x9TmCzEHxOq02crg1hKrR05M2bKl+esIvvYiMYzFgB rhJg==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@quicinc.com header.s=qcppdkim1 header.b=J9HscVfo; arc=pass (i=1 spf=pass spfdomain=quicinc.com dkim=pass dkdomain=quicinc.com dmarc=pass fromdomain=quicinc.com); spf=pass (google.com: domain of linux-kernel+bounces-50618-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-50618-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=quicinc.com X-Forwarded-Encrypted: i=1; AJvYcCVXejHy2uOd2L7C7lwgb6d5ab7Wa4m5yUo2Wno+RiHyHMWMvlN6z7aVxpJsYUeWmG4IC8ipN6d7k4YDTuY/+BeMKtZOghD2jA/i2toNcw== Return-Path: Received: from am.mirrors.kernel.org (am.mirrors.kernel.org. [2604:1380:4601:e00::3]) by mx.google.com with ESMTPS id j7-20020a170906050700b00a37041276a9si912908eja.412.2024.02.02.13.38.40 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 02 Feb 2024 13:38:40 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-50618-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=J9HscVfo; arc=pass (i=1 spf=pass spfdomain=quicinc.com dkim=pass dkdomain=quicinc.com dmarc=pass fromdomain=quicinc.com); spf=pass (google.com: domain of linux-kernel+bounces-50618-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-50618-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 E4F891F27AA3 for ; Fri, 2 Feb 2024 21:38:39 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 7B94D83A02; Fri, 2 Feb 2024 21:38:30 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=quicinc.com header.i=@quicinc.com header.b="J9HscVfo" 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 DAA3B839E5; Fri, 2 Feb 2024 21:38:27 +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=1706909909; cv=none; b=oby+88b7QC4TUPwqNhbochdRlvrRTGQ8OWkL2WgTfSYsQPSdv5cdtL/r+kS0KKZIzYAQbUaNk1b7DFsXHzmdtYrwVfgRJZPdcFjCV9hGSvNljcwSrKDnb1ldWVZyCfPY83hxvKcW2RRzuOfOEoFO44D7ZPyvEbfTSzwZNPCdSoI= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1706909909; c=relaxed/simple; bh=lqCpQsXVTy+dSJVBp3WfGbAzEvkjwDZvUChqW8CkS9k=; h=Message-ID:Date:MIME-Version:Subject:To:CC:References:From: In-Reply-To:Content-Type; b=MvzDNUWHqO4ER+kl2uFqiMuydOkhNhxu+b18XDRUwaV2y5OeJOU7Yi6ofzbOSxtXxDco4PIL3dy4NlbHBB9d8zksyTu4eqN9gJMN3KMC7kueL5++IPYOcWoAnQcjNF8B0UywDp2qYU8vXNQxxIQtZpdewjJwHH4TAKuXFTAMKIA= 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=J9HscVfo; 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 (m0279868.ppops.net [127.0.0.1]) by mx0a-0031df01.pphosted.com (8.17.1.24/8.17.1.24) with ESMTP id 412Jwwg1021603; Fri, 2 Feb 2024 21:38:01 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=ldFHZ0O8cBXpgd6zgNxpsJBeusJDBKoGQUskWZPAlbg=; b=J9 HscVfoeIg7tDcfDd1V6Fz5rZdddFJw9+bk6G9r/8sa7pNOJP/F5LycM438m9M8uw KGHyvRBQPkSehsSFES02OU5tkcASAef8EMBhHBzlxKS8IKWh5IZ6y7Sp+bp5XDHi rBthvJ6TCr85XjViA9C+F/FcvRslEANPzJCovSgtj39SXRMDaxLvRJ/i0M+UQFez l1hGB5reDm17+Lsm8dT10YxqJxeTuaP+HwG7H3skeDLpoUtbwNfk8dCjyzBrkjxt xR+NhlcUhDDCwLMJOdt32If+DJSHIAJjFxRYgU5eiYT5xlVQv+zonIawUDynZt/W MGSY8m9y1XbM4L6pl5/w== Received: from nalasppmta03.qualcomm.com (Global_NAT1.qualcomm.com [129.46.96.20]) by mx0a-0031df01.pphosted.com (PPS) with ESMTPS id 3w0pu1tfwu-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Fri, 02 Feb 2024 21:38:00 +0000 (GMT) Received: from nalasex01c.na.qualcomm.com (nalasex01c.na.qualcomm.com [10.47.97.35]) by NALASPPMTA03.qualcomm.com (8.17.1.5/8.17.1.5) with ESMTPS id 412LbxU0028229 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Fri, 2 Feb 2024 21:37:59 GMT Received: from [10.110.44.7] (10.80.80.8) by nalasex01c.na.qualcomm.com (10.47.97.35) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.1118.40; Fri, 2 Feb 2024 13:37:58 -0800 Message-ID: <073bcb5c-6718-4a64-8d14-281a589d2205@quicinc.com> Date: Fri, 2 Feb 2024 13:37:58 -0800 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [PATCH 6/9] remoteproc: qcom_q6v5_wcss: Use devm_rproc_alloc() helper Content-Language: en-US To: Andrew Davis , Bjorn Andersson , Mathieu Poirier , Shawn Guo , Sascha Hauer , Pengutronix Kernel Team , Fabio Estevam , NXP Linux Team , Konrad Dybcio , Patrice Chotard , Maxime Coquelin , Alexandre Torgue CC: , , , References: <20240123184632.725054-1-afd@ti.com> <20240123184632.725054-6-afd@ti.com> <256072b3-c1d0-4e11-9456-bbd50b84a310@quicinc.com> <60d46d58-ad77-47e8-8ff6-bc05db7cf1be@ti.com> From: Unnathi Chalicheemala In-Reply-To: <60d46d58-ad77-47e8-8ff6-bc05db7cf1be@ti.com> Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: 8bit X-ClientProxiedBy: nasanex01a.na.qualcomm.com (10.52.223.231) To nalasex01c.na.qualcomm.com (10.47.97.35) X-QCInternal: smtphost X-Proofpoint-Virus-Version: vendor=nai engine=6200 definitions=5800 signatures=585085 X-Proofpoint-GUID: 34GYM_9AIe1L18E8Zn0iret852KAD9m2 X-Proofpoint-ORIG-GUID: 34GYM_9AIe1L18E8Zn0iret852KAD9m2 X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.272,Aquarius:18.0.1011,Hydra:6.0.619,FMLib:17.11.176.26 definitions=2024-02-02_14,2024-01-31_01,2023-05-22_02 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 suspectscore=0 mlxscore=0 impostorscore=0 clxscore=1015 mlxlogscore=999 malwarescore=0 lowpriorityscore=0 phishscore=0 priorityscore=1501 adultscore=0 spamscore=0 bulkscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.19.0-2401310000 definitions=main-2402020159 On 2/2/2024 1:14 PM, Andrew Davis wrote: > On 2/2/24 2:51 PM, Unnathi Chalicheemala wrote: >> >> >> On 1/23/2024 10:46 AM, Andrew Davis wrote: >>> Use the device lifecycle managed allocation function. This helps prevent >>> mistakes like freeing out of order in cleanup functions and forgetting to >>> free on error paths. >>> >>> Signed-off-by: Andrew Davis >>> --- >>>   drivers/remoteproc/qcom_q6v5_wcss.c | 24 +++++++++--------------- >>>   1 file changed, 9 insertions(+), 15 deletions(-) >>> >>> diff --git a/drivers/remoteproc/qcom_q6v5_wcss.c b/drivers/remoteproc/qcom_q6v5_wcss.c >>> index cff1fa07d1def..94f68c919ee62 100644 >>> --- a/drivers/remoteproc/qcom_q6v5_wcss.c >>> +++ b/drivers/remoteproc/qcom_q6v5_wcss.c >>> @@ -1011,8 +1011,8 @@ static int q6v5_wcss_probe(struct platform_device *pdev) >>>       if (!desc) >>>           return -EINVAL; >>>   -    rproc = rproc_alloc(&pdev->dev, pdev->name, desc->ops, >>> -                desc->firmware_name, sizeof(*wcss)); >>> +    rproc = devm_rproc_alloc(&pdev->dev, pdev->name, desc->ops, >>> +                 desc->firmware_name, sizeof(*wcss)); >>>       if (!rproc) { >>>           dev_err(&pdev->dev, "failed to allocate rproc\n"); >>>           return -ENOMEM; >>> @@ -1027,29 +1027,29 @@ static int q6v5_wcss_probe(struct platform_device *pdev) >>>         ret = q6v5_wcss_init_mmio(wcss, pdev); >>>       if (ret) >>> -        goto free_rproc; >>> +        return ret; >>>         ret = q6v5_alloc_memory_region(wcss); >>>       if (ret) >>> -        goto free_rproc; >>> +        return ret; >>>         if (wcss->version == WCSS_QCS404) { >>>           ret = q6v5_wcss_init_clock(wcss); >>>           if (ret) >>> -            goto free_rproc; >>> +            return ret; >>>             ret = q6v5_wcss_init_regulator(wcss); >>>           if (ret) >>> -            goto free_rproc; >>> +            return ret; >>>       } >>>         ret = q6v5_wcss_init_reset(wcss, desc); >>>       if (ret) >>> -        goto free_rproc; >>> +        return ret; >>>         ret = qcom_q6v5_init(&wcss->q6v5, pdev, rproc, desc->crash_reason_smem, NULL, NULL); >>>       if (ret) >>> -        goto free_rproc; >>> +        return ret; >>>         qcom_add_glink_subdev(rproc, &wcss->glink_subdev, "q6wcss"); >>>       qcom_add_ssr_subdev(rproc, &wcss->ssr_subdev, "q6wcss"); >>> @@ -1061,16 +1061,11 @@ static int q6v5_wcss_probe(struct platform_device *pdev) >>>         ret = rproc_add(rproc); >>>       if (ret) >>> -        goto free_rproc; >>> +        return ret; >>>         platform_set_drvdata(pdev, rproc); >>>         return 0; >>> - >>> -free_rproc: >>> -    rproc_free(rproc); >>> - >>> -    return ret; >> >> This return statement should stay, right? >> > > No path goes to "free_rproc" anymore, so we always do the "return 0;" > above on non-error paths. > > Andrew > You're right, thanks all QCOM peripheral patches LGTM. >>>   } >>>     static void q6v5_wcss_remove(struct platform_device *pdev) >>> @@ -1080,7 +1075,6 @@ static void q6v5_wcss_remove(struct platform_device *pdev) >>>         qcom_q6v5_deinit(&wcss->q6v5); >>>       rproc_del(rproc); >>> -    rproc_free(rproc); >>>   } >>>     static const struct wcss_data wcss_ipq8074_res_init = {