From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-wm1-f44.google.com (mail-wm1-f44.google.com [209.85.128.44]) (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 3F1C03A1E80 for ; Fri, 26 Dec 2025 09:40:01 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.128.44 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1766742004; cv=none; b=bizF472YSBwZ+2/WQe+DD5zLFVu3v5yhI0MCZZptTmEb33iYRJ0wIE/0niwtxORhiugIaI2cANHoM8Rt9Za4Gzp5mIUXJB1wmb53tkwIS1l0yaq4+t3ZByWj6b8O4dkygoedjEYKf8W4brhvIY8kBa3wffsU0ghF6ddeVn2FPY4= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1766742004; c=relaxed/simple; bh=VLvokI7a/hDZW9FiIYhB+E/S5twC8Ei+o0F0Ou5nw8I=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=o352CGmecM3Go/gtM8gk4Sevgy6Fmr2EDkiqFuaF4ZKn67CPKf7VGYurZSL3nCrWWGex2weUPgmEIZycsQQCBUW2G8PocCm3zHFcRAXuDyU2opglHHtGs16sRmsXLu8Ow54GJgTCmyIrDeCSDxwimymYOW6a5zMkh01d5NtZqic= 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=LZ0lTobx; arc=none smtp.client-ip=209.85.128.44 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="LZ0lTobx" Received: by mail-wm1-f44.google.com with SMTP id 5b1f17b1804b1-477a2ab455fso69009555e9.3 for ; Fri, 26 Dec 2025 01:40:01 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1766742000; x=1767346800; 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=az+/i3OnvpeSw9QBjkFEo+G8RK0rnKgYizEwvKs3SkI=; b=LZ0lTobx/n1mXvYk9At9Ay/vzdvKcKCVJM4+SelaiwvucNWk5loNDZGLZQeTy5v5+q HcvFsyzhoukOyzcZeppbbrAf1iXSN0sRNoJfpmbj95JI0ZkDx2xTolfFpbb/Gf5CZGZ6 UrY3bqfm9xuKoG6BIHqI4hkaWEBqr5iMaZiqXcyPkyTinUigc+E5OPQdXXUQ4jlRpkCG cNMta5r1UzD6tzAUL9c2cJcxqXLNfBGlGH6MoMkWdvD415qcvitBoDplLfRsSUgQq3iS OyFp/YH5bgbRD7aRx2O225t/LJx+vq1RqKHp1GaxMKfhO4KwK83LLGJj8dEWChRm/rKl iekA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1766742000; x=1767346800; 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=az+/i3OnvpeSw9QBjkFEo+G8RK0rnKgYizEwvKs3SkI=; b=XEmlQkzyyHyyFvHcIvK+k4t3uPAzTlc78Cg23fRmwwiXVAPUt1uFxI54HDq9HX6YiL ZuE1l2pjPrXQPMeZYSnFGAGxNGQ9oXuTeXRxjXs34w5qab5mKd4mhIH7SWW8pag+OhY6 TnUxIG1jBB2igS5PrLcBAb6ZAzI1oTQNOxiSDFXi2qtDRuh1fxYuXci7DF+Ud4imhgjQ EEItsVfJOndu23P1+p7+lArFb4na+/vKasPnQCfsM238gnZl5WHaDhvFqsa2CVJ4fY3Q yQKVtDhiIJcTpGftWVSJJVQOUTPrti44+nQBFG03CncCsPCEPUYZyktu/931Lug4CSRZ uYAw== X-Forwarded-Encrypted: i=1; AJvYcCV3vO4QGqDTZWxKGwHNZeG23dNOSwRHYNZfqIw/2BaCvlmPPH3oTfZc/Utl0AsMaiVxuCCayIbTvpPw1sQ=@vger.kernel.org X-Gm-Message-State: AOJu0Yypqhlijjo765FQBY5uafUyLpmzYKaj2qQLvJuue0PqMJPTeZ88 /00VrgyKCEa6zF7S+thQ4Gl8jUhLyHI3ZRKhsoWKUw3XJOn9AcDgoc70Jc0+Y+Y3QxE= X-Gm-Gg: AY/fxX661JZYBpEDAUedGUxixyafPdVv1uCbZYu0KC4zKQkBZTWPMXLse++zACevoWy Ef1ct71q5EflkMHwOj60LuU9SjRw8Fu01NQqQ+eaH+HlzPxN33Z268ve0JJode/VXTiJfps0rKb SWJ95yKqxRELq24NEeTkSf+jvcaFYFQUtTgXYcJXgisyuHmP/GiCYLj+qj9rZKLDvQ8z+XJKXEu WOFGbUvt5YWPFrjBzIayVcePFMh9Ym1Ip1ruLxxsG/gOznYhc7ESrEmP/SYdXdI23Hygvr0qHM9 N4AB/XT6GEXeh4Nhr9OFLH3ZACJdeDboMQQiGSo+vP+1FAyCGKNUrr+/Ml+FSvwnYq7YQ0INj/L ufuN9E1wiuLfR1D4e4+4A5KXgO71BYOewJkzpCbLGFdTM9T1T/G4mleMMxl6RmKWupX/bFyuLY3 rWHj3U0gwttJIY67Oc X-Google-Smtp-Source: AGHT+IE9OFj2HfnlgFleWoTH3rxJpkalg7/y6n0R4uHDNui9njYMj6Eh/CedwIxzu80u1IRcIdtN2w== X-Received: by 2002:a05:600c:4e42:b0:47b:de05:aa28 with SMTP id 5b1f17b1804b1-47d1956eb65mr193897495e9.2.1766742000394; Fri, 26 Dec 2025 01:40:00 -0800 (PST) Received: from localhost ([196.207.164.177]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-47d193cba81sm376536275e9.10.2025.12.26.01.39.59 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 26 Dec 2025 01:39:59 -0800 (PST) Date: Fri, 26 Dec 2025 12:39:57 +0300 From: Dan Carpenter To: Haoxiang Li Cc: chleroy@kernel.org, ioana.ciornei@nxp.com, linux-kernel@vger.kernel.org, linuxppc-dev@lists.ozlabs.org, suhui@nfschina.com Subject: Re: [PATCH] bus: fsl-mc: fix an error handling in fsl_mc_device_add() Message-ID: References: <20251224112600.1592218-1-lihaoxiang@isrc.iscas.ac.cn> 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: <20251224112600.1592218-1-lihaoxiang@isrc.iscas.ac.cn> On Wed, Dec 24, 2025 at 07:26:00PM +0800, Haoxiang Li wrote: > On Wed, 24 Dec 2025 12:07:22 +0100, Christophe Leroy wrote: > > Ah yes, I see. > > > > But then all exit paths in fsl_mc_device_add() after device_initialize() > > should call put_device() ? > > > Then in fact the fix should instead be the following, shouldn't it ? > > > diff --git a/drivers/bus/fsl-mc/fsl-mc-bus.c > > b/drivers/bus/fsl-mc/fsl-mc-bus.c > > index 25845c04e562..6d132144ce25 100644 > > --- a/drivers/bus/fsl-mc/fsl-mc-bus.c > > +++ b/drivers/bus/fsl-mc/fsl-mc-bus.c > > @@ -905,11 +905,7 @@ int fsl_mc_device_add(struct fsl_mc_obj_desc *obj_desc, > > return 0; > > > > error_cleanup_dev: > > - kfree(mc_dev->regions); > > - if (mc_bus) > > - kfree(mc_bus); > > - else > > - kfree(mc_dev); > > + put_device(&mc_dev->dev); > > > > return error; > > } > > Yes, I think so. > However, I submit a same fix months ago and got a reply: > https://lore.kernel.org/all/2025052622-nautical-suitably-486c@gregkh/ > > I didn't figure out why, and look forward to experts' guidance. That's a different patch. Perhaps it didn't apply? *shrug*. Christophe's patch looks correct to me. regards, dan carpenter