From mboxrd@z Thu Jan 1 00:00:00 1970 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 5760327B359 for ; Sun, 4 Jan 2026 22:42:45 +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=1767566567; cv=none; b=ikf3cgpQ8zdUBcUsGtIeegaTtPfC0HNd3loKKY6SJy66JR7xI5hij6HK/tSb4eUKew1oiljUfd2JaXvaIP8d1V1w30241bK1gt+eQ83G/cr69Kh5n0H+c0JK8z468EtU8MH08jRF2nVvGKAWwycjPNojghT5yfSeKQefJNWPsI4= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1767566567; c=relaxed/simple; bh=Z766a5eKhtLpv6IfPQN7+0qKX1TYy4S4ZuAf+IF+n78=; h=Message-ID:Date:MIME-Version:Subject:To:References:From: In-Reply-To:Content-Type; b=ss38loXuL01crsJo1Rt7OPmOEm5kzgEqby39ndNdLYP0Whae7mpplzIH4ho0RSo1LiyG/X6Dbeg+on346IllNIoCLLtUUFtSzIiGS3/6n9hsfMmbOtKFttS8qzAoaoazrNC6rOpXT/R2cUU1ezL3a895efrHn+WHJRQjg2dY3UY= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=oss.qualcomm.com; spf=pass smtp.mailfrom=oss.qualcomm.com; dkim=pass (2048-bit key) header.d=qualcomm.com header.i=@qualcomm.com header.b=jtF5udo2; dkim=pass (2048-bit key) header.d=oss.qualcomm.com header.i=@oss.qualcomm.com header.b=ShcFKGzG; arc=none smtp.client-ip=205.220.180.131 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=oss.qualcomm.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=oss.qualcomm.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=qualcomm.com header.i=@qualcomm.com header.b="jtF5udo2"; dkim=pass (2048-bit key) header.d=oss.qualcomm.com header.i=@oss.qualcomm.com header.b="ShcFKGzG" Received: from pps.filterd (m0279869.ppops.net [127.0.0.1]) by mx0a-0031df01.pphosted.com (8.18.1.11/8.18.1.11) with ESMTP id 604M7lUv3945900 for ; Sun, 4 Jan 2026 22:42:44 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=qualcomm.com; h= content-transfer-encoding:content-type:date:from:in-reply-to :message-id:mime-version:references:subject:to; s=qcppdkim1; bh= O/7vNr+DsrMEaDFspG2Z8LOHW88kZTo5Sbi3yhf6BjA=; b=jtF5udo2icRVijyB loIP/l7ROdQFZsLu6mrl5mS4kr55HTiJZ0VqWrVCWo8eaT4ONlymGWZTKqhdodIQ kFhbilShCgKz8zt/ViPGmnczpzJZ/NI0X/1Yx0AwQ1BQ5GR7qqwY3sKGZXIJDKg0 HEPNcpupjK80eTD1BPvTCoBH0ug7mtqgkBzmKAM//r2xAROjoBtHTGvZ/Wd7Catx YXY+4fhuTjmzhRZMhzg8uelXlCT5l4+lbQD/XdLE7q4jTDSd7TJOQ4tUGYNlv8L0 1G4/YrJWXz3wSj7GSDs8iUvN96ogLVbO5fvIDQt0h2C5ontNkbaMc+xXY8pg4QRA RovmWw== Received: from mail-pf1-f197.google.com (mail-pf1-f197.google.com [209.85.210.197]) by mx0a-0031df01.pphosted.com (PPS) with ESMTPS id 4bet462p1a-1 (version=TLSv1.3 cipher=TLS_AES_128_GCM_SHA256 bits=128 verify=NOT) for ; Sun, 04 Jan 2026 22:42:44 +0000 (GMT) Received: by mail-pf1-f197.google.com with SMTP id d2e1a72fcca58-7b6b194cf71so25837965b3a.3 for ; Sun, 04 Jan 2026 14:42:43 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oss.qualcomm.com; s=google; t=1767566563; x=1768171363; darn=vger.kernel.org; h=content-transfer-encoding:in-reply-to:from:content-language :references:to:subject:user-agent:mime-version:date:message-id:from :to:cc:subject:date:message-id:reply-to; bh=O/7vNr+DsrMEaDFspG2Z8LOHW88kZTo5Sbi3yhf6BjA=; b=ShcFKGzGrCqMjono6XBUcwcMUYIoAhnA0qqyFLJc/x2LZQKIJUOur1+UI2gTMbN8X+ Uwl2WXyBUFXWZVJ2wWREG19eFs3AJU6Lp7xNfCaHPS7w86NZXsvmMzVEn95OXiF0CeLY MO/LAMUx2sRqUgBI6l5pW7Sr6dBERcUJqj9ICfJW28J3VOOO2Xv4+nQM96tHNrMt+TWC MBZGVT2CS/aECdS4u/7pNeaImw6L3Xi+lnmeeR/Whq4GeWHyiQUPLcHvQoKFA+AWYmAX BpHZbg+7QO6J4N4OnIJNvdG/H63Qh1z3OHizUZLK+hYsTV/C9zSxNsA1JhwWBOLGeWSF EAFA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1767566563; x=1768171363; h=content-transfer-encoding:in-reply-to:from:content-language :references:to:subject:user-agent:mime-version:date:message-id :x-gm-gg:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=O/7vNr+DsrMEaDFspG2Z8LOHW88kZTo5Sbi3yhf6BjA=; b=WTWYzIV0LUDSY/NihqoiXKQrxKBjEMz6wRltSCcTmi82EZ6BD0s03R1fyX3FOJbTpQ o2UYNU65YS+zO107/iAbBGLg7H0pQXLFIPBNPPkWh1gesmgi5HF3cyQ2mzKKxb0xkf9l JObCJ1QGs1Ub83Yz9OomvBOM2TIyFOhCA+4Zo0wcA2npK0Itt8U/g84UktERJZ3Bi0Sj O4hJ8K3nRUOXcSVoH6IlBmY4YAWpPXROD4esANwnGhppsp/3N9xHU9NzM9amL+hXNA7v H9yLWXHkaQp5G91oMwm3Xv62uDqR7jf0++51VLiRxDb7KUQr/3kIP+HyKgMzeT1X5Ovo U1vA== X-Forwarded-Encrypted: i=1; AJvYcCXj5yJUZ+aRyCkjR2g5QsOPbV10DiFaW8zw0Uw4s4R8kh0oicEqdcYMwZlttBJCtdBTC7zLZ8JMNeaYN4c=@vger.kernel.org X-Gm-Message-State: AOJu0Yx0+8HkaXpQ20l+9Al0qH5YSlrSzL6shQBZ01sR4hRftwujzNAk FnUMJtEOyc7IhAzECRqtg51Smf82EWzmh7WCjq471r3RWxmYjib+X36YLX30O811ArflIn0r0CT Gb+j0X08y9jAMSe3ZF5YdAdxhHHgMeWTWp4JEUc3JwG+l3SFOh+/HMRhd19Fl8VlUNg== X-Gm-Gg: AY/fxX6/ag/auOG6rSGyn4GxI58P//wSp0uW23SRVa1SD9i69rPQ3fBgaw4nYC6YvMW 6IbCNfZzu67daZ9mRW6oSWy9z7ZFAenqgFiFj5nz2H3JxGZ0o60ZelOQYX9SB55p1QOSO4ongyK ytjV6Ht03JLmkGSoowAus2AxlrKh+EKsaAxKYtv5dt+8BahEMES57TfKXeRW1jzWw1zMfGlfJKA b9+XYg3kDjJvfvUL7R00vaqfrbmmbJuhUwArvbgkgwRX4hiHa5Q+e4v7rHzgZBxTT6kmeHTnPRg lRSI+W2Spb/3ZqIG8ycrJX36DFU6FYuCnbbJS8w1sB2qzWJx6RMotvfi5TnCM2kiMm+Iu/i8IHb YDakUbbxwDSf0z6W9u0hTO95BcIjdJbCvq+pB/p58c55dXeRDrMa5hvMqkqHhSMjd6IawNFxBK2 e0y1R1vuU= X-Received: by 2002:a05:6a00:414b:b0:7e8:4471:ae5a with SMTP id d2e1a72fcca58-7ff67456b8fmr45161607b3a.38.1767566563091; Sun, 04 Jan 2026 14:42:43 -0800 (PST) X-Google-Smtp-Source: AGHT+IHDuO73OCc1uAmvVfcN/wqa6d0iKBoYARuBWGAYA0w4rRlXhl21neol3T/X6jIAjYp7WFJBEQ== X-Received: by 2002:a05:6a00:414b:b0:7e8:4471:ae5a with SMTP id d2e1a72fcca58-7ff67456b8fmr45161592b3a.38.1767566562587; Sun, 04 Jan 2026 14:42:42 -0800 (PST) Received: from [192.168.0.74] (n1-41-240-65.bla22.nsw.optusnet.com.au. [1.41.240.65]) by smtp.gmail.com with ESMTPSA id d2e1a72fcca58-7ff7b22536esm45620684b3a.23.2026.01.04.14.42.39 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Sun, 04 Jan 2026 14:42:42 -0800 (PST) Message-ID: Date: Mon, 5 Jan 2026 09:42:37 +1100 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 1/3] tee: qcomtee: call: Fix confusing cleanup.h syntax To: Krzysztof Kozlowski , Jens Wiklander , Sumit Garg , linux-arm-msm@vger.kernel.org, op-tee@lists.trustedfirmware.org, linux-kernel@vger.kernel.org References: <20251208020844.5310-4-krzysztof.kozlowski@oss.qualcomm.com> Content-Language: en-US From: Amirreza Zarrabi In-Reply-To: <20251208020844.5310-4-krzysztof.kozlowski@oss.qualcomm.com> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit X-Proofpoint-Spam-Details-Enc: AW1haW4tMjYwMTA0MDIwOCBTYWx0ZWRfX9ylr8OObLHHp +6xIQy8SO5+OyIuUJP8wtw34J7xZ9YvkB1aOe4bx5gck6+MSyiCM1/60E0hrftRCQlFaMlxCaZO F6p7ZBe1kcE7PDDMjTouq47gU0kmvDGttDuzI4v0EQlPgov+jDeDTxKEA5sfoRI12HHA/3Lc2vR 4UZstFiwXMNEPGbpVWIFcKVBADDtkKPQc08HKDfjKCKPZ40wTyb7IqUn1iJUtyJRaNMLY0DJgXi VrAkpAYojvWkTJN9WAFoLylEkytrosj3S+MbOIIPL1r83ob3kSr3g7BV53fpN5P2UEHNgsaopW7 zEn0y8E5CU4EFQmzdyNnvWd2AfpQtPlpPpquBJUNBgKL9DOkIeNBgsKvT5mJrdFVHURawxW7Z+f o1eIEFLFE/xMnXI3HrqEeCcjiK3bjzt2OSASNlXxvJr/b2QjNEpN7OdppyHmmTyxld/osBGsNF+ D8FjJ9ERO6KkL+88Q8w== X-Authority-Analysis: v=2.4 cv=UuVu9uwB c=1 sm=1 tr=0 ts=695aece4 cx=c_pps a=rEQLjTOiSrHUhVqRoksmgQ==:117 a=hi51d+lTLNy/RbqRqnOomQ==:17 a=IkcTkHD0fZMA:10 a=vUbySO9Y5rIA:10 a=s4-Qcg_JpJYA:10 a=VkNPw1HP01LnGYTKEx00:22 a=EUspDBNiAAAA:8 a=f4zK_zY1VO43RE-C1HAA:9 a=QEXdDO2ut3YA:10 a=2VI0MkxyNR6bbpdq8BZq:22 X-Proofpoint-GUID: HOrg9FjeLFQsJpaltGwAKH-7AYqFK-r0 X-Proofpoint-ORIG-GUID: HOrg9FjeLFQsJpaltGwAKH-7AYqFK-r0 X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.293,Aquarius:18.0.1121,Hydra:6.1.9,FMLib:17.12.100.49 definitions=2026-01-04_06,2025-12-31_01,2025-10-01_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 bulkscore=0 priorityscore=1501 suspectscore=0 clxscore=1015 phishscore=0 adultscore=0 impostorscore=0 malwarescore=0 lowpriorityscore=0 spamscore=0 classifier=typeunknown authscore=0 authtc= authcc= route=outbound adjust=0 reason=mlx scancount=1 engine=8.22.0-2512120000 definitions=main-2601040208 On 12/8/2025 1:08 PM, Krzysztof Kozlowski wrote: > Initializing automatic __free variables to NULL without need (e.g. > branches with different allocations), followed by actual allocation is > in contrary to explicit coding rules guiding cleanup.h: > > "Given that the "__free(...) = NULL" pattern for variables defined at > the top of the function poses this potential interdependency problem the > recommendation is to always define and assign variables in one statement > and not group variable definitions at the top of the function when > __free() is used." > > Code does not have a bug, but is less readable and uses discouraged > coding practice, so fix that by moving declaration to the place of > assignment. > > Signed-off-by: Krzysztof Kozlowski > --- > drivers/tee/qcomtee/call.c | 17 ++++++++--------- > 1 file changed, 8 insertions(+), 9 deletions(-) > Reviewed-by: Amirreza Zarrabi - Amir > diff --git a/drivers/tee/qcomtee/call.c b/drivers/tee/qcomtee/call.c > index 65f9140d4e1f..8f8830f0df26 100644 > --- a/drivers/tee/qcomtee/call.c > +++ b/drivers/tee/qcomtee/call.c > @@ -395,9 +395,7 @@ static int qcomtee_object_invoke(struct tee_context *ctx, > struct tee_ioctl_object_invoke_arg *arg, > struct tee_param *params) > { > - struct qcomtee_object_invoke_ctx *oic __free(kfree) = NULL; > struct qcomtee_context_data *ctxdata = ctx->data; > - struct qcomtee_arg *u __free(kfree) = NULL; > struct qcomtee_object *object; > int i, ret, result; > > @@ -412,12 +410,14 @@ static int qcomtee_object_invoke(struct tee_context *ctx, > } > > /* Otherwise, invoke a QTEE object: */ > - oic = qcomtee_object_invoke_ctx_alloc(ctx); > + struct qcomtee_object_invoke_ctx *oic __free(kfree) = > + qcomtee_object_invoke_ctx_alloc(ctx); > if (!oic) > return -ENOMEM; > > /* +1 for ending QCOMTEE_ARG_TYPE_INV. */ > - u = kcalloc(arg->num_params + 1, sizeof(*u), GFP_KERNEL); > + struct qcomtee_arg *u __free(kfree) = kcalloc(arg->num_params + 1, sizeof(*u), > + GFP_KERNEL); > if (!u) > return -ENOMEM; > > @@ -562,9 +562,8 @@ static int qcomtee_supp_send(struct tee_context *ctx, u32 errno, u32 num_params, > > static int qcomtee_open(struct tee_context *ctx) > { > - struct qcomtee_context_data *ctxdata __free(kfree) = NULL; > - > - ctxdata = kzalloc(sizeof(*ctxdata), GFP_KERNEL); > + struct qcomtee_context_data *ctxdata __free(kfree) = kzalloc(sizeof(*ctxdata), > + GFP_KERNEL); > if (!ctxdata) > return -ENOMEM; > > @@ -645,12 +644,12 @@ static void qcomtee_get_version(struct tee_device *teedev, > static void qcomtee_get_qtee_feature_list(struct tee_context *ctx, u32 id, > u32 *version) > { > - struct qcomtee_object_invoke_ctx *oic __free(kfree) = NULL; > struct qcomtee_object *client_env, *service; > struct qcomtee_arg u[3] = { 0 }; > int result; > > - oic = qcomtee_object_invoke_ctx_alloc(ctx); > + struct qcomtee_object_invoke_ctx *oic __free(kfree) = > + qcomtee_object_invoke_ctx_alloc(ctx); > if (!oic) > return; >