From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-qk1-f178.google.com (mail-qk1-f178.google.com [209.85.222.178]) (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 67A6338BF61 for ; Mon, 15 Jun 2026 19:36:01 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.222.178 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1781552162; cv=none; b=cr5Gkit/wfS73nmjnanPL2O0AOahaFN5BL9skjjEdj8g6NOmoOAidgQV3AEb2aAlaYihGTrecjtrZWLF8KCH0EkSRUtESTLMm42QnLd8mpuAXcVi+BiSCy2BtjnS2VxFXNBuyguti8t6dGaA6lFZ766KjBWiZAw7ETz24jFAH4I= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1781552162; c=relaxed/simple; bh=uMhztNgRD1EESCZjob0rF6VtxtONAWtHJ2DlXAmP3Ng=; h=From:To:Cc:Subject:Date:Message-ID:MIME-Version; b=Erp7oKqmrWaH2ohA+L7h0FPcDxSwYHLgxgoS6x6nV4wQUaOwrQjowWM0WopbXRQdqNCD3Z4y0xGwJovjdKVnaAFUMk5j3nbTquhVs5UfLNIJsLv1itHjW2TjsnP4R0K0buHWthXpXf4q3Ao/c/7sEMsMaOqLP75L+1BQTlJs9vo= 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=Pg87UPAU; arc=none smtp.client-ip=209.85.222.178 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="Pg87UPAU" Received: by mail-qk1-f178.google.com with SMTP id af79cd13be357-91563abd6a9so187030785a.3 for ; Mon, 15 Jun 2026 12:36:01 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20251104; t=1781552160; x=1782156960; 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=ilAD6oyPZ7+Z6NH640c4kq09bsKFwmP8miYWEEZmjKc=; b=Pg87UPAUky3dglcDWnZuiRityam6JiKt1f1WfJDJDBXK3JbzPvc0mivEfNquH62zpX U0yJA/2perouqAdweA89UIPIRjLEj4TR0vKjkpx4XwyjdWWinOElQbQFtsbq1YeiSLmj BvNAYgCjXfKkcivQXlicI1JFiAPKqkk6EpcfeV/KMwm/QWDSh4ajCYSbGO13RAQWsV0g mYmuefBleQEN1Dfw/v0CkVE8bdIdYLecGnLQZ6nfkwjL4uDh/3KNmoqQKcWfJs3X0qf3 T9uzOmA9+CBHxNKSmT6aRCOJCZxiMj/EkpWWOkcebsmCVOngYENl6BxXItb9kcLlGXXC gnOg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1781552160; x=1782156960; 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=ilAD6oyPZ7+Z6NH640c4kq09bsKFwmP8miYWEEZmjKc=; b=LrTT9xvzQuAW9D0jgDAyZDgzJ5YEdJ7JSsCyBdDlKqnqZQ11jk7NCISf11tPROL0HE 2ExUJL2OFEiS3Qr1ogb32g+AUS2lT15p/auPtV44b2JHZkhWtpZ9rCzgAXUOyo8gniBr zsTpZ33O1a79cRshFSfTzUKAuosLTTrMU/G+XSaCAl2LvxsaLeqtDa0ON5+cN0kb8Gsv 7WKUt58kAwrjKMxeYecnAqSG4RjtRynLVMBQSvarNmhj5mnIgjmh1OxPjMi9IgDbeEML eoO6gwoZMG1+dP7bLFXI9f2hozp4Q/V83JShIyqIUuDHKnbldk2IL6CcuWJ3FQyzaK7B me+Q== X-Forwarded-Encrypted: i=1; AFNElJ8R/G5NRJFdRPjIpEmcTqbBnbWXwvwfMWu6PcU07kzorUSwD+lNweEJzsgsLciXVLOcxxfDpyUyMkQ7yHE=@vger.kernel.org X-Gm-Message-State: AOJu0YzbrtLYdKmanO3EhbanNoqwceYWPRQzcvRnWOC1Fp41M8fV3N7D YZWm0JMfWoKzGAe+FjKQNafrjSGHKT8gtoI+wof71NXr27OCnu8QJVYL X-Gm-Gg: Acq92OETeaLVQKyq8dSYt11XN9SuKTXU3OhCVEFOcaXDfaRY5pz3Cwyipp9C9JIRJsI mLU07mQ4cprDgaBnguPfACHSReGRX/c7wu4TyayY5ILCpHKtmLkhlRaR3WRYS8Tg75tJvXbNtOU o5LNQsVHJS6uZTi/jRS5v7eYydjDL3Xn0nHu/4Oy9yZrFPnoQI0Vg2QhO7OasmVozG3SJw3XQzh 8ykZWVjXYN3smdTPqDFtvRpP1wNjUKFXVvuEswG6mbohBjiMX64CGYGBrIRo9LsmGhuE5CICypi LetIfAE6Z5PQXNJbWngp88Wi8q+SrKqocD1B11PMMnB5fzIl3janxyvSH6WPOIHijhXRAvoA9+X H1JRVy1l8RI10IJ/Krl0vGVwyv++Una8P16dgn4AmEVt9sV9V9FIyiXReJAjd6QGtmHlxoZzBTP OAJzBaempbNPrVwHrTHvvIoMNHIq1+zyktIKr0EUVDrPU6TNmagwE= X-Received: by 2002:a05:620a:19a7:b0:915:7732:ea7c with SMTP id af79cd13be357-91c48072442mr80258585a.43.1781552160197; Mon, 15 Jun 2026 12:36:00 -0700 (PDT) Received: from i4-gl-tmk5904.ad.psu.edu ([130.203.156.186]) by smtp.gmail.com with ESMTPSA id af79cd13be357-9161a00af50sm1319190785a.30.2026.06.15.12.35.59 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 15 Jun 2026 12:35:59 -0700 (PDT) From: Yuho Choi To: Maarten Lankhorst , Maxime Ripard , Thomas Zimmermann , David Airlie , Simona Vetter Cc: dri-devel@lists.freedesktop.org, linux-kernel@vger.kernel.org, Yuho Choi Subject: [PATCH v1] drm/mipi-dsi: Use put_device() on device_add() failure Date: Mon, 15 Jun 2026 15:35:55 -0400 Message-ID: <20260615193555.757498-1-dbgh9129@gmail.com> X-Mailer: git-send-email 2.43.0 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit mipi_dsi_device_alloc() initializes the embedded struct device before mipi_dsi_device_register_full() calls mipi_dsi_device_add(). If device_add() fails, the code frees the DSI object directly with kfree(), bypassing the device release callback. Drop the initialized device reference with put_device() instead, so mipi_dsi_dev_release() runs and releases resources owned by the device, including the OF node reference. Fixes: 068a00233969 ("drm: Add MIPI DSI bus support") Signed-off-by: Yuho Choi --- drivers/gpu/drm/drm_mipi_dsi.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/gpu/drm/drm_mipi_dsi.c b/drivers/gpu/drm/drm_mipi_dsi.c index 0390e14d3157..862d56eaf934 100644 --- a/drivers/gpu/drm/drm_mipi_dsi.c +++ b/drivers/gpu/drm/drm_mipi_dsi.c @@ -233,7 +233,7 @@ mipi_dsi_device_register_full(struct mipi_dsi_host *host, ret = mipi_dsi_device_add(dsi); if (ret) { dev_err(host->dev, "failed to add DSI device %d\n", ret); - kfree(dsi); + put_device(&dsi->dev); return ERR_PTR(ret); } -- 2.43.0