From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-wr1-f41.google.com (mail-wr1-f41.google.com [209.85.221.41]) (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 EE2B02DCC03 for ; Wed, 26 Nov 2025 08:58:59 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.221.41 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1764147541; cv=none; b=FiKqyO1vRZXbEy/gpYiaXINCT+UoFDCIBkAhH7ocughFoXoozrBL9IUF34CyZuny02lMWK00MmRyW/BzoydRp0vnjSwySRbCGQ0W4NPll5Q1Opx+uX2LdXnloDK11w5OszqtTXsme+Gg3i56kDLfZM+viUDD3MLYTfj/ORY5Wok= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1764147541; c=relaxed/simple; bh=nU9T+5BRaB/fG6RWKtMtWKMNEJMLJZh0XG1iyTeeGec=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=nVm63MKbcCJNBvnAFehVbtn7tZydKBam0ZVAg2RxTgTcFPZ15tMITAc0vU5qnx1Vf141L/RjtWGzpCIYgIsEWme7wjtgkSol1c/3cs41FdxqQIlMu31LB4OlEdpTEiiC5OPdWjp8Td9kOYRw4VhUVbYk/L0axBLPo+LzZIrzW2k= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linaro.org; spf=pass smtp.mailfrom=linaro.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b=faarhEay; arc=none smtp.client-ip=209.85.221.41 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linaro.org Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linaro.org Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b="faarhEay" Received: by mail-wr1-f41.google.com with SMTP id ffacd0b85a97d-42bb288c17bso3879716f8f.2 for ; Wed, 26 Nov 2025 00:58:59 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1764147538; x=1764752338; darn=vger.kernel.org; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:from:to:cc:subject:date:message-id:reply-to; bh=/42H8lhYTk9A336jJOzqFf4ArqhwdfQJRSwAMTmYgKw=; b=faarhEayto4ghep1tOnl20UpBjexmnHOVnmxXLl3q7YnaBHo57suwzR+jobYILlhbW vjvuTt0doFCVqQVYZ99A5aZsxDVGJV/W3xf4plFJjwGJqVCgwQoP28yBdMkXHn0hmITq PqrDqdSa8TJz9WvkEhqzkj+McyOXLLBY4smijwK+F88/WAG4o2QjatQbvbgXNIbIKwWl 1Fn83oIcoE0VqVOmDqsa70d6lYZUlL8G28f7IOg479d1jKCMGclWB2ewE81Q9Zr9s9hI wJDqnxLLTzbHekVBc1deRLlTrb2C4Z2obOFiHBYfJ6y0VTW+QzwYjtOn2VMJGGNuy2bO 9oKg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1764147538; x=1764752338; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:x-gm-gg:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=/42H8lhYTk9A336jJOzqFf4ArqhwdfQJRSwAMTmYgKw=; b=GUwQHaoamHcj6YF669gszrvEAuOSrqnXkNNecKHVnmrZsAtJmHsiH+CQH+RFcVm7Mq EloeTEVmnWv298dyAGRlQ8X9cM3CEUJVZJjD7PF4QzzWln/AgbY+Tcu/QbJkvwE9rSD1 ifLDabNAhHJkY724MG3PA/iG/52VQlptauxz+bsY5O28woDkWAw7wnckFv49EwHJcbBZ qDpX1Qyubld023PYCZVVaKjrMoCqBUa6o6yuarwf3GGUL21k3En4cZ0bq9ivXq0RLkE5 UKLMzWDYffz1k5g7/djrA+bk/N77Q5I10SlOEictHkvfkWGbz5ZxplK7KmnA+UHv0lO8 9Mag== X-Forwarded-Encrypted: i=1; AJvYcCUOFEku5SrM7KU+EE9SP+74fXa6/+tvInlgMFDoWVycwUi4tBXAqQVEUAUfzdnxDQj5u4Rpjmrakve4+P8=@vger.kernel.org X-Gm-Message-State: AOJu0YxHqC2G+aa3OES0aPDdMtG1rUM1VQDS4nBuSrMd6k9OtvOibaBw NO0S4vcr+qiRSFxn9MGOnLxW+x5tzdLmgteckBFD0DlFCflDYbPWH9e3P8nvHQ4Dq0s= X-Gm-Gg: ASbGncsiS+IKrpRQULxiDsWJH/4p1E+bjNGZuZyEiZuFW1J8Smcn3l6wIQlwZhe0O/D wW571PitTxprjrSrHLKNpgxywP0MHN3NArWPP7Gf06L3ZXjcNo23+OjykRe65EPlkXcY+JgZvyk 2zK1XdHJzkhnIr8o4BVZwu7oZUfRoghzIBKgr7ls3QMAJ0fZD9KSu4A7M3vA9gwoAD6dZS74QGb 0V5+oVcDhnbPb/C0q+rj5KgiVAJ5qmrP16yonU+dQL5q7LD26tWhVBCfymGIESPtrugFoqY+Obu d2EUulO1ddWqcuedd/IUM10M5uDr5x2P1pbwZY9D7tB2A6xs98qF1ADuBjle00DEHOEIfk0wqca E++yp74W2FA9bsqNd3IUPm3wbmFlcvMOdocBrhkbj9BaeDycT9QdPrG+aEbwVvUlAZ0W65iBgt+ XZnB1VSIbqqBdVLs2T X-Google-Smtp-Source: AGHT+IFv1Ops8n0OeoStz9TaphopQIFsUQ0FZ2Z6R6T+mCfhb8iJ7KwfJE3DEPeRt9VhmuTMP2gI6A== X-Received: by 2002:a5d:5848:0:b0:427:8c85:a4ac with SMTP id ffacd0b85a97d-42cc1d0c9d6mr20256329f8f.47.1764147538171; Wed, 26 Nov 2025 00:58:58 -0800 (PST) Received: from localhost ([196.207.164.177]) by smtp.gmail.com with UTF8SMTPSA id ffacd0b85a97d-42cb7fba20esm39223866f8f.37.2025.11.26.00.58.57 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 26 Nov 2025 00:58:57 -0800 (PST) Date: Wed, 26 Nov 2025 11:58:52 +0300 From: Dan Carpenter To: Dharanitharan R Cc: thierry.reding@gmail.com, jonathanh@nvidia.com, skomatineni@nvidia.com, luca.ceresoli@bootlin.com, mchehab@kernel.org, gregkh@linuxfoundation.org, linux-media@vger.kernel.org, linux-tegra@vger.kernel.org, linux-staging@lists.linux.dev, linux-kernel@vger.kernel.org Subject: Re: [PATCH v1] media: tegra: vi: replace devm_kzalloc with kzalloc in probe Message-ID: References: <20251126065242.12186-1-dharanitharan725@gmail.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20251126065242.12186-1-dharanitharan725@gmail.com> On Wed, Nov 26, 2025 at 06:52:42AM +0000, Dharanitharan R wrote: > Replace devm_kzalloc() (line 1881) with kzalloc() in tegra_vi_probe() > since memory must be freed manually in error paths. Freed via kfree() in > rpm_disable, as recommended in the file comment (line 1204). > drivers/staging/media/tegra-video/vi.c 1197 static int tegra_vi_channel_alloc(struct tegra_vi *vi, unsigned int port_num, 1198 struct device_node *node, unsigned int lanes) 1199 { 1200 struct tegra_vi_channel *chan; 1201 unsigned int i; 1202 1203 /* 1204 * Do not use devm_kzalloc as memory is freed immediately 1205 * when device instance is unbound but application might still 1206 * be holding the device node open. Channel memory allocated 1207 * with kzalloc is freed during video device release callback. 1208 */ 1209 chan = kzalloc(sizeof(*chan), GFP_KERNEL); 1210 if (!chan) 1211 return -ENOMEM; 1212 The comment is specific to "chan". Your patch introduces a number of memory leaks and it's not correct. regards, dan carpenter