Received: by 2002:a05:6a10:1287:0:0:0:0 with SMTP id d7csp1487685pxv; Fri, 16 Jul 2021 10:24:25 -0700 (PDT) X-Google-Smtp-Source: ABdhPJw2c2nyn5zVMs8NTPlaIO6crh5RTpEkwqQskwBbyNKYNArEBAU/xwxclSuFRXs+xwBb+Ubz X-Received: by 2002:a17:906:f2d7:: with SMTP id gz23mr12866899ejb.314.1626456264857; Fri, 16 Jul 2021 10:24:24 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1626456264; cv=none; d=google.com; s=arc-20160816; b=z1wBIuINfNtE8L3gt7n4LClRlZcCHtShLpTKyowNxh7+pKMePbJwq56iaZCjoVe7Kv RSjUE4C9q25TDuMYMq3Ggr0AAfGPLF0rUMb3r8Br+Jhdtr6Dbn5xyAbN0Xo1weGOguyW mXcCu4DQr95Djs7XACVh7GdHE8VUR1+r7v6Bb16xQBt37+SnycjF+ZKJT7wycLShAfmX xG6W6AMiqF34cODUS1g9R/K5O/WJPjRiG9svAyaEpWBBcSLNLisk+Su/cefXRftHvyL5 e0tR3wnQTfvFL0O7cyy3gOShhlXPcV2fsQhyz4wNlVzLb7WuqSUwaUtfYOKPVwSuaYdk 8Q4g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:subject:message-id:date:from:in-reply-to :references:mime-version:dkim-signature; bh=3c+sIMooxtvDJVn8odY5JLFWl/IcyMyFIVxI67a4xSE=; b=qHjGnsdNHoQ+mkpnPGytCELojXNFpZ3V+bH2gERUXLeQuhGOGjBHIE2HVFKH/8ZFCS FsrbKP0YDch+skKoe1fxhBuJq2GXkkPHbiTElFP7wCAvenY8OW+vvrOxIPLSTjz3NBWK jbO3KDegxsD0hby0XkzS8W207+r4z8Fbt2cREg4vKxQqxozaWL3CZDYNzt9x7yC5II4h n0jeevWMjxIwBwIdaEvkrzmS3dCl8NfE3NH4Cw/3lecBl5WK5/uhLDD03MsZgsejvCp0 7OjEaoOVtYgTrwEYzJVvbMhapKCsaSBRa4Qui27f0Lw+iFywtpWry0MYYNsSOPQ3Ba/b WX4w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@solid-run-com.20150623.gappssmtp.com header.s=20150623 header.b="C/KEm8SY"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id dq22si13654952ejc.661.2021.07.16.10.24.01; Fri, 16 Jul 2021 10:24:24 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@solid-run-com.20150623.gappssmtp.com header.s=20150623 header.b="C/KEm8SY"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231313AbhGPRZ3 (ORCPT + 99 others); Fri, 16 Jul 2021 13:25:29 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:53434 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230287AbhGPRZ1 (ORCPT ); Fri, 16 Jul 2021 13:25:27 -0400 Received: from mail-ej1-x631.google.com (mail-ej1-x631.google.com [IPv6:2a00:1450:4864:20::631]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 38BB6C06175F for ; Fri, 16 Jul 2021 10:22:32 -0700 (PDT) Received: by mail-ej1-x631.google.com with SMTP id hd33so16221400ejc.9 for ; Fri, 16 Jul 2021 10:22:32 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=solid-run-com.20150623.gappssmtp.com; s=20150623; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=3c+sIMooxtvDJVn8odY5JLFWl/IcyMyFIVxI67a4xSE=; b=C/KEm8SY1qRUq8mfvLz7OVdGBiu3jZv76CDgZzY2pjAN2b4Wx2YLbSoRxo4KrQ5Ing oZLQNbWqO67GD4pM9c8sevTAv4rCOm8nYLVIMxZNr5pXR0ma9pIFlzYXMaXh6Drv4FG5 H5a2NqUUia2w9A2+QMZ/tduTd4VTxtqYjqr66pTRe4Mxy26VP86vCKTDcbyt142T9DJ5 RCoMmd7r1+su12GBNvh6fUs2U0H38lW+rzaVVRq/yrqNQ4Yx3cTygD8KvO1iiPhc655M 7eD+aBBT3gaDqt/N0TCshI6/k3C3WIE4uRjhQtYg0liO5sY/sUFXER+PDXhBpsbBVSTq o4zA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=3c+sIMooxtvDJVn8odY5JLFWl/IcyMyFIVxI67a4xSE=; b=SkFg6ErLQNkQ3yJ5Wzf/rKvmW3Lw8OxZpV/TMpQLj5w0Gd9UdRf8D9xLWeKsbco1Jz wykjmZDO9bjErsxlWHIT1v91Sqspbva0tdkwg0GEZmdYF+ae2IF9GobFZu0XKWMszWy6 9vklIUolbcaCUvVmuBZOGFD3SgBfdMu/QSGX9UWHCOLT/SBPDQ0O2EzHuMEfE2mJwFwB QkbkDUjRmiNHBMlN9rL1F2hccLwtb1plrNYLB9TySEYqPmp2wR6GQQ06Y15ImMhp8THq HmxtKaD+LUucJVtMGcr44sp3NNzE9xnhuttYPf8QSo4UzoM2k7NaagRL7Pxd5pix2UcY Cp/Q== X-Gm-Message-State: AOAM530F4TNExN1RkxTZhfhtB9XgJ4jzCGF1+F7naWI5L1pZijvKCEKu vDQSUvjjluHmwrX4hDsn0JC8/qxik5cJCioAIBwWxZIlrUM7qA== X-Received: by 2002:a17:906:3699:: with SMTP id a25mr12875173ejc.452.1626456150821; Fri, 16 Jul 2021 10:22:30 -0700 (PDT) MIME-Version: 1.0 References: <20210716101602.1891-1-laurentiu.tudor@nxp.com> In-Reply-To: From: Jon Nettleton Date: Fri, 16 Jul 2021 19:21:53 +0200 Message-ID: Subject: Re: [PATCH] software node: balance refcount for managed sw nodes To: Andy Shevchenko Cc: Laurentiu Tudor , Heikki Krogerus , Greg Kroah-Hartman , "Rafael J . Wysocki" , ACPI Devel Maling List , Linux Kernel Mailing List Content-Type: text/plain; charset="UTF-8" Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Fri, Jul 16, 2021 at 2:17 PM Andy Shevchenko wrote: > > On Fri, Jul 16, 2021 at 01:16:02PM +0300, laurentiu.tudor@nxp.com wrote: > > From: Laurentiu Tudor > > > > software_node_notify(), on KOBJ_REMOVE drops the refcount twice on managed > > software nodes, thus leading to underflow errors. Balance the refcount by > > bumping it in the device_create_managed_software_node() function. > > > > The error [1] was encountered after adding a .shutdown() op to our > > fsl-mc-bus driver. > > Looking into the history of adding ->shutdown() to dwc3 driver (it got reverted > later on), I can tell that probably something is wrong in the ->shutdown() > method itself. > > -- > With Best Regards, > Andy Shevchenko > > Isn't the other alternative to just remove the second kobject_put from KOBJ_REMOVE ? @@ -1149,7 +1147,6 @@ int software_node_notify(struct device *dev, unsigned long action) if (swnode->managed) { set_secondary_fwnode(dev, NULL); - kobject_put(&swnode->kobj); } break; default: If we aren't being incremented in device_create_managed_software_node() then should we be decremented here? -Jon