Received: by 2002:a05:6a10:1287:0:0:0:0 with SMTP id d7csp4323684pxv; Tue, 27 Jul 2021 04:46:03 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxokDUgn4vikG+8kyO0SnbMbMZGsoGf6WTiU8S75WRuZ0gXJSTD1ZeNhLxVT5kW87qEX9J9 X-Received: by 2002:a17:906:f15:: with SMTP id z21mr21501169eji.177.1627386363093; Tue, 27 Jul 2021 04:46:03 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1627386363; cv=none; d=google.com; s=arc-20160816; b=r4dNKjZpzdYTbxDePRyK/1abC1kpNamEmMjuw1CFpGl7zOpjxHj2U5ORdWe/P/t+z8 3A1+toscn39UOS/t+WDPjmMhOPeknOsQcTkoxyKpGlX6/QPo6scMA4SZi2MlknXHrw// OPRqhG1OotZF06m2QUbvWeLpFCCPIVhsmniowqKZn3hPRY7UcifO1H5emcQlBshd7yQJ Mq/9UKkRDwS41uNHWIoIgskwfUan3HBYpUSUwKybS+/F/jr2nn2rMCsa0xcnsovd5zsd hV9Y3MOW/OflYdFBnn2ZfLa2BvYCXR7vvP+151k65hqxHjRH9Npub4te/0/YzVJpesB8 vLLA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date; bh=z1HaAzwDJad+iGtaYXS3PFpbcFnVkZ1OKaeLze/cV8c=; b=tMLXX9nLy5g9NeGH8ztBVLmfkViz/XznrwI8csn5ZzbLpDAr8th7avJ7hwOwVpWjst tL9a/5KDPmzJwmdt11jJEX7Ex27a2oicNBvGSjdWtsaM+sxYwm2gh6ouXzfIiO84tZUJ LyJjXMApli5kskKELLlke+REZQDQietug8CDiOiZ1VXRRHkIlIT8Y/PCAmu6sXagq4lH 9RM8j5hd3NyymZt/PdKPJ19z+7HZ96CHMpBPEjpqL7VZOnbZdj7N2FO69u6Vlp6cjYqV UgO9dh9N2RUewNVPtGQ/ABDj4hIJlMFAEnHkEiVwN9k1QcjzPPyCB31qHRHpJoI5SUHU AqRw== ARC-Authentication-Results: i=1; mx.google.com; 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 n30si2505778edb.121.2021.07.27.04.45.39; Tue, 27 Jul 2021 04:46:03 -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; 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 S236406AbhG0LmY (ORCPT + 99 others); Tue, 27 Jul 2021 07:42:24 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:37842 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236108AbhG0LmX (ORCPT ); Tue, 27 Jul 2021 07:42:23 -0400 Received: from metis.ext.pengutronix.de (metis.ext.pengutronix.de [IPv6:2001:67c:670:201:290:27ff:fe1d:cc33]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 2A10DC061757 for ; Tue, 27 Jul 2021 04:42:24 -0700 (PDT) Received: from drehscheibe.grey.stw.pengutronix.de ([2a0a:edc0:0:c01:1d::a2]) by metis.ext.pengutronix.de with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1m8LTZ-0008Fl-7Y; Tue, 27 Jul 2021 13:42:21 +0200 Received: from [2a0a:edc0:0:900:1d::77] (helo=ptz.office.stw.pengutronix.de) by drehscheibe.grey.stw.pengutronix.de with esmtp (Exim 4.92) (envelope-from ) id 1m8LTY-0006DO-EJ; Tue, 27 Jul 2021 13:42:20 +0200 Received: from ukl by ptz.office.stw.pengutronix.de with local (Exim 4.92) (envelope-from ) id 1m8LTY-0004no-DN; Tue, 27 Jul 2021 13:42:20 +0200 Date: Tue, 27 Jul 2021 13:42:20 +0200 From: Uwe =?utf-8?Q?Kleine-K=C3=B6nig?= To: Finn Thain Cc: Greg Kroah-Hartman , linux-m68k@lists.linux-m68k.org, linux-kernel@vger.kernel.org, kernel@pengutronix.de Subject: Re: [PATCH 1/5] nubus: Simplify check in remove callback Message-ID: <20210727114220.7drjl6xvvlwetaod@pengutronix.de> References: <20210727080840.3550927-1-u.kleine-koenig@pengutronix.de> <20210727080840.3550927-2-u.kleine-koenig@pengutronix.de> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha512; protocol="application/pgp-signature"; boundary="3qa463uuge64uyhr" Content-Disposition: inline In-Reply-To: X-SA-Exim-Connect-IP: 2a0a:edc0:0:c01:1d::a2 X-SA-Exim-Mail-From: ukl@pengutronix.de X-SA-Exim-Scanned: No (on metis.ext.pengutronix.de); SAEximRunCond expanded to false X-PTX-Original-Recipient: linux-kernel@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org --3qa463uuge64uyhr Content-Type: text/plain; charset=iso-8859-1 Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Tue, Jul 27, 2021 at 07:50:39PM +1000, Finn Thain wrote: > On Tue, 27 Jul 2021, Uwe Kleine-K=F6nig wrote: >=20 > > The driver core only calls a remove callback when the device was > > successfully bound (aka probed) before. So dev->driver is never NULL. >=20 > Are you sure dev->driver is non-NULL for the lifetime of the device? > A quick glance at device_reprobe() makes me wonder about that. Not for the lifetime of the device, but as long as a driver is bound to the device. device_reprobe() calls device_driver_detach() after which the driver is considered unbound and dev->driver is assigned NULL. (via device_driver_detach -> device_release_driver_internal -> __device_release_driver) > > Apart from that, the compiler might already assume dev->driver being > > non-NULL after to_nubus_driver(dev->driver) was called. >=20 > I don't understand how a compiler can make that assumption. But then, I= =20 > don't know why compilers do a lot of the things they do... Ah, you're right, there is no dereference in container_of, so I might also be wrong here. I will send a v2 without this last sentence in the commit log. Best regards Uwe --=20 Pengutronix e.K. | Uwe Kleine-K=F6nig | Industrial Linux Solutions | https://www.pengutronix.de/ | --3qa463uuge64uyhr Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iQEzBAABCgAdFiEEfnIqFpAYrP8+dKQLwfwUeK3K7AkFAmD/8RkACgkQwfwUeK3K 7Aly9gf/X/9+HHgTAce8RPe1LYj8/3GYbuadCfJ0vOWrFRpxQOdRflGtxFeRhvIl 4+BchXWByjjnMCH6jkZVgyMdSZQRmHTA266AWnOu4xW+ujr+qX+hlcyFD4p6PI/c xFM1HnW8EZESlb/8vbXSNLMMI6e9QbMVXVgNEgyiXNmXhCAW9lL1c8lqop8XS8rB d2xvZ35+qVAryL83AjAI74nIOtx99/vrdWZqEMjPQJQS/owTV8hG0UFzKZkjf9bt 1fiI0u+n3RIHM+rkOLABH9v1lfQZvqQJJHv+jtO06yzHXRuoUS6TEchO3xPyQjot uy+j3AhFCJQ8sAyp6f7/tDfROgtB8A== =lQGM -----END PGP SIGNATURE----- --3qa463uuge64uyhr--