From: Josip Rodin Subject: Re: [PATCH] of: fix race when matching drivers Date: Wed, 18 May 2011 17:45:17 +0200 Message-ID: <20110518154517.GA26070@entuzijast.net> References: <20110517.134312.226762699.davem@davemloft.net> <1305732459_6563@mail4.comsite.net> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Return-path: Content-Disposition: inline In-Reply-To: <1305732459_6563@mail4.comsite.net> Sender: sparclinux-owner@vger.kernel.org To: Milton Miller Cc: Grant Likely , David Miller , devicetree-discuss@lists.ozlabs.org, linux-kernel@vger.kernel.org, sparclinux@vger.kernel.org List-Id: devicetree@vger.kernel.org On Wed, May 18, 2011 at 10:27:39AM -0500, Milton Miller wrote: > --- work.git.orig/include/linux/of_device.h 2011-05-18 09:57:01.014386816 -0500 > +++ work.git/include/linux/of_device.h 2011-05-18 09:58:27.537431575 -0500 > @@ -21,8 +21,15 @@ extern void of_device_make_bus_id(struct > static inline int of_driver_match_device(struct device *dev, > const struct device_driver *drv) > { > - dev->of_match = of_match_device(drv->of_match_table, dev); > - return dev->of_match != NULL; > + const struct of_device_id *match; > + > + match = of_match_device(drv->of_match_table, dev); > + if (match) { > + dev->of_match = of_match_device(drv->of_match_table, dev); > + return 1; > + } > + > + return 0; > } Err, is there some reason to avoid simply assigning the existing result: dev->of_match = match; ? -- 2. That which causes joy or happiness.