From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751389AbbE0Eff (ORCPT ); Wed, 27 May 2015 00:35:35 -0400 Received: from mail-pd0-f175.google.com ([209.85.192.175]:36626 "EHLO mail-pd0-f175.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750751AbbE0Efd (ORCPT ); Wed, 27 May 2015 00:35:33 -0400 Date: Wed, 27 May 2015 10:05:19 +0530 From: Sudip Mukherjee To: Greg KH Cc: David Cohen , =?iso-8859-1?Q?Bj=F8rn?= Mork , Heikki Krogerus , Tal Shorer , Sasha Levin , USB list , "" , Felipe Balbi , Lu Baolu Subject: Re: [PATCH] usb: ulpi: don't register drivers if bus doesn't exist Message-ID: <20150527043519.GA3096@sudip-PC> References: <1432150406-20550-1-git-send-email-sasha.levin@oracle.com> <20150524071948.GA20923@kroah.com> <20150524080940.GA4033@sudip-PC> <20150525114010.GA30679@kuha.fi.intel.com> <20150525161312.GB9772@kroah.com> <87a8wsoan6.fsf@nemi.mork.no> <20150526175401.GA26397@psi-dev26.jf.intel.com> <20150527024118.GD7038@kroah.com> MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <20150527024118.GD7038@kroah.com> User-Agent: Mutt/1.5.21 (2010-09-15) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, May 26, 2015 at 07:41:18PM -0700, Greg KH wrote: > On Tue, May 26, 2015 at 10:54:01AM -0700, David Cohen wrote: > > Hi, > > > > On Mon, May 25, 2015 at 07:00:13PM +0200, Bjørn Mork wrote: > > > Greg KH writes: > > > > Don't mess with bus->p. I can rename it to > "do_not_touch_this_isnt_for_you" if people think that would make it more > obvious that a private data structure shouldn't be messed with in any > way. Outside of the driver core, you have no knowledge that even if it > is a pointer, what that means with regards to anything. Being a newbie I had a newbie kind of doubt that if a module is builtin and the init fails then what happens to the functions exported by it. And to test that I created a module: int abcd(void) { pr_err("test: in abcd\n"); return 0; } EXPORT_SYMBOL(abcd); static int __init test_init(void) { return -ENOMEM; } module_init(test_init); static void __exit test_exit(void) { } module_exit(test_exit); Compiled it as builtin, and created another module which calls abcd(); and as expected abcd() executed. So same thing can happen here also: if bus_register() in ulpi_init() fails then also ulpi_unregister_driver() can be executed as the symbol has been exported. you are saying bus->p is private and not to use that but you are also saying that if we use another variable to keep the status of bus registration then the design is wrong. Then what should be the correct way? regards sudip > > thanks, > > greg k-h