From nobody Thu Apr 9 14:56:44 2026 Received: from mail-pf1-f180.google.com (mail-pf1-f180.google.com [209.85.210.180]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 6770B18DF9D for ; Sat, 7 Mar 2026 21:04:12 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.210.180 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1772917453; cv=none; b=Wxr0BfKIPxC7017K+n7tvwZG7BPbCqNDPuTx5BMmVFolRkKBKCgWptVqQZMdO7cwLoOgZNkkeolN3ltq70ydR3HLbxW0EVAILu47uI+5wvZ61kBWMsGxDRb2gl01Cm8dZlfLj354h1KjtBqz0oyLjcBCLRlp63M8KPRX7Ha3fgI= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1772917453; c=relaxed/simple; bh=9Exg2USVLa4xlv4w7Vw8HDXr3p6qjKZogGGviGgbgOI=; h=From:To:Cc:Subject:Date:Message-Id:MIME-Version; b=JV91HnaDoBLXPBtAM59A83b1Jb7ssP2+fA8csgg6NTuyn6KFVtED9EAz/a8PT29BOFZ9JrVkFeltaZ7taJZ/94bz3Qb1p3fjsXr7dT/FMeHiXI1MHzz94TkOoIZVGJM6W/VEM1xM3o2HNntXJ+4PBJhMeMQp6w/S9/AJXZ2/ppc= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=AtsuS63a; arc=none smtp.client-ip=209.85.210.180 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="AtsuS63a" Received: by mail-pf1-f180.google.com with SMTP id d2e1a72fcca58-8299f1ca894so1072847b3a.2 for ; Sat, 07 Mar 2026 13:04:12 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1772917452; x=1773522252; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:from:to:cc:subject:date:message-id:reply-to; bh=SGXhq2UxUJDL3aAv90iI2xuTf9Opn9T2dvuqIOW5Q3g=; b=AtsuS63aGNjiGEMVLx7voRmYFI/PLWixO+Fj0B4/BOXsbd0JA/yTWk40ER2fV5wxYd O444hkjAycvJ4eZPjU9NpdB/q7cjohmmrZyEPro0D9jBGmjdF9kqaV/jhjRWh208V82J VlpHZrjaqd/NwdDW8qBm25y8r1aioDvD9n8kTCSMCrgDabRyVgSaGtboHt/9Jq8QtFua 4X3gcRHvgwpXatZ6vUal50VOKJ68MiyxZOPpvrcC1ZVft2EWVed/byEgVHusBbGnVpxR Mn0XQrUf/dVOINX3FFmux30kwWR2945lbjdJS1nFgzduh2MmOxT25hdRI29QOjEgQBu7 b53Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1772917452; x=1773522252; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:x-gm-gg:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to; bh=SGXhq2UxUJDL3aAv90iI2xuTf9Opn9T2dvuqIOW5Q3g=; b=ezTG3z9HYyc1dgqoIDQ8fWR00WS31Bt3ZvAHS6WkyVlFo42/IcTEt3qgONq9akzzPS YepCtOhobXmrZNocpOH5anu3MnyuMqkM4AYf4Tr6H9Onw6T0qniFWQEvnyP/hpveUjeg Zc9ZHnnqT3+K0YF095me8F55qFqpKsh2OG9HrSuPMXQAOPkQBaZMM0AW2WcVgi3f9Nb7 zX8oaVyjxDQAmRrZQ5LYbNOQEXzmNKWb1u5dBZg5ROjS6CczFtOEPFHeWSt32tqLDCb3 oghgVP5T2OuuWdjUuBiaoil0G//nJ9Cg/E+Ob1ChS95V9J6o808HCG/rdc6fRcKRERCo PwSA== X-Forwarded-Encrypted: i=1; AJvYcCV6D+SPz7MLMBZZU4INn+FzcRN3EHqi5x3Q9oMkPArbO4EaqrBzyVv/J7qbLCcpKJTNzhvhUWtXem0F+aI=@vger.kernel.org X-Gm-Message-State: AOJu0YzpF/IxqrV9l/jy6NXw4BLyyP5NuM/dOT50W6xeXfHQ2V/6zAlM XcOZAGvhJ4vI+5gmudpbOR59Vf3TNLx+qzfRN9C3S+vqI6I6jgOFFX/f X-Gm-Gg: ATEYQzzl6G9ZMLiZm7+feaiNijYLyw5Ptdl9fCd+qgulV24Kc+KYnJDvyPo/MkwkXbT 0p4x/G3ni2E/JfZJzUSqtI51/+mDS3+1zMXrlH5LnkjS2N8olKGketR39n9bRpXKTIDe0DkC/fZ noon/B6gRQiFkszG3DKWaCbZOiFx/eUW4wRif3cN5GFnIe/yqTE/WDUGhEJqGV6QCjYbgfGZSJn A79ImU3LRCauVpgiaJdd0mq1VoJjDAUfm99akoqampTToh9urPytXkPdw/R4CBPkA6qAYBvOqUE +0zdx1ZlfqRukvH+/6OncRRIZOI8thiNWcNDALU/YSudqYQ1gNxcF6uRnLfq91T6Twi0sJO15f0 DwHX0a4YB3+/jbjBoBddETO0SAwfGCNfBvdkE6evYgLFhy+E7RgqWsLwKgHt+HSSjDPJz4pPTe+ r02raXicTIMlGNVDTwLQ11EiGsdhwB0+pLOWNJm0sk6Np07oqSxwkWWHwoag4= X-Received: by 2002:a05:6a21:9cc9:b0:341:5935:e212 with SMTP id adf61e73a8af0-39858fd5915mr6251896637.18.1772917451630; Sat, 07 Mar 2026 13:04:11 -0800 (PST) Received: from hu-ckantibh-hyd.qualcomm.com ([202.46.23.25]) by smtp.gmail.com with ESMTPSA id 41be03b00d2f7-c739e182d72sm4840124a12.25.2026.03.07.13.04.07 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 07 Mar 2026 13:04:11 -0800 (PST) From: Sanjay Chitroda X-Google-Original-From: Sanjay Chitroda To: mirela.rabulea@nxp.com, mchehab@kernel.org, Frank.Li@nxp.com, s.hauer@pengutronix.de Cc: kernel@pengutronix.de, festevam@gmail.com, linux-media@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, skhan@linuxfoundation.org Subject: [PATCH] media: imx-jpeg: convert kzalloc() to devm_kzalloc() Date: Sun, 8 Mar 2026 02:34:04 +0530 Message-Id: <20260307210404.1428894-1-sanjayembedded@gmail.com> X-Mailer: git-send-email 2.34.1 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" From: Sanjay Chitroda The driver allcoates memory using kzalloc() and frees it in the relase path. since the allocated memory is tied to the lifetime of the device, devm_kzalloc() can be used instead. Using device-managed allocation simplifies the error handling paths and remove the need for manual cleanup. No functional change intended. Signed-off-by: Sanjay Chitroda --- drivers/media/platform/nxp/imx-jpeg/mxc-jpeg.c | 11 +++-------- 1 file changed, 3 insertions(+), 8 deletions(-) diff --git a/drivers/media/platform/nxp/imx-jpeg/mxc-jpeg.c b/drivers/media= /platform/nxp/imx-jpeg/mxc-jpeg.c index b558700d1d96..bd4b5f08a85c 100644 --- a/drivers/media/platform/nxp/imx-jpeg/mxc-jpeg.c +++ b/drivers/media/platform/nxp/imx-jpeg/mxc-jpeg.c @@ -2200,14 +2200,12 @@ static int mxc_jpeg_open(struct file *file) struct mxc_jpeg_ctx *ctx; int ret =3D 0; =20 - ctx =3D kzalloc(sizeof(*ctx), GFP_KERNEL); + ctx =3D devm_kzalloc(dev, sizeof(*ctx), GFP_KERNEL); if (!ctx) return -ENOMEM; =20 - if (mutex_lock_interruptible(&mxc_jpeg->lock)) { - ret =3D -ERESTARTSYS; - goto free; - } + if (mutex_lock_interruptible(&mxc_jpeg->lock)) + return -ERESTARTSYS; =20 v4l2_fh_init(&ctx->fh, mxc_vfd); v4l2_fh_add(&ctx->fh, file); @@ -2246,8 +2244,6 @@ static int mxc_jpeg_open(struct file *file) v4l2_fh_del(&ctx->fh, file); v4l2_fh_exit(&ctx->fh); mutex_unlock(&mxc_jpeg->lock); -free: - kfree(ctx); return ret; } =20 @@ -2754,7 +2750,6 @@ static int mxc_jpeg_release(struct file *file) v4l2_m2m_ctx_release(ctx->fh.m2m_ctx); v4l2_fh_del(&ctx->fh, file); v4l2_fh_exit(&ctx->fh); - kfree(ctx); mutex_unlock(&mxc_jpeg->lock); =20 return 0; --=20 2.34.1