From mboxrd@z Thu Jan 1 00:00:00 1970 From: Pavel Machek Date: Wed, 25 Nov 2020 10:46:29 +0000 Subject: Re: [PATCH] leds: lp50xx: Fix an error handling path in 'lp50xx_probe_dt()' Message-Id: <20201125104629.GE25562@amd> MIME-Version: 1 Content-Type: multipart/mixed; boundary="idY8LE8SD6/8DnRI" List-Id: References: <20200922210515.385099-1-christophe.jaillet@wanadoo.fr> <20200923133510.GJ4282@kadam> <20200924064932.GP18329@kadam> <20200928115301.GB3987353@kuha.fi.intel.com> In-Reply-To: <20200928115301.GB3987353@kuha.fi.intel.com> To: Heikki Krogerus Cc: Dan Carpenter , Christophe JAILLET , dmurphy@ti.com, jacek.anaszewski@gmail.com, linux-leds@vger.kernel.org, linux-kernel@vger.kernel.org, kernel-janitors@vger.kernel.org --idY8LE8SD6/8DnRI Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable Hi! > > > > I have been trying to teach Smatch to understand reference counting= so > > > > it can discover these kinds of bugs automatically. > > > >=20 > > > > I don't know how software_node_get_next_child() can work when it do= esn't > > > > call kobject_get(). This sort of bug would have been caught in tes= ting > > > > because it affects the success path so I must be reading the code w= rong. > > > >=20 > > >=20 > > > I had the same reading of the code and thought that I was missing som= ething > > > somewhere. > > >=20 > > > There is the same question about 'acpi_get_next_subnode' which is als= o a > > > '.get_next_child_node' function, without any ref counting, if I'm cor= rect. > > >=20 > >=20 > > Yeah, but there aren't any ->get/put() ops for the acpi_get_next_subnod= e() > > stuff so it's not a problem. (Presumably there is some other sort of > > refcounting policy there). >=20 > OK, so I guess we need to make software_node_get_next_child() > mimic the behaviour of of_get_next_available_child(), and not > acpi_get_next_subnode(). Does the attached patch work? Does not sound unreasonable. Did it get solved, somehow? Best regards, Pavel --=20 http://www.livejournal.com/~pavelmachek --idY8LE8SD6/8DnRI Content-Type: application/pgp-signature; name="signature.asc" Content-Description: Digital signature -----BEGIN PGP SIGNATURE----- Version: GnuPG v1 iEYEARECAAYFAl++NgUACgkQMOfwapXb+vIHzwCgworQ7zr2uP1ShsLQgTp5zabE BLcAnjZC4LxmDlCixRQv6XHtwCEAST/3 =iaU9 -----END PGP SIGNATURE----- --idY8LE8SD6/8DnRI--