public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Sudip Mukherjee <sudipm.mukherjee@gmail.com>
To: Greg KH <gregkh@linuxfoundation.org>
Cc: "David Cohen" <david.a.cohen@linux.intel.com>,
	"Bjørn Mork" <bjorn@mork.no>,
	"Heikki Krogerus" <heikki.krogerus@linux.intel.com>,
	"Tal Shorer" <tal.shorer@gmail.com>,
	"Sasha Levin" <sasha.levin@oracle.com>,
	"USB list" <linux-usb@vger.kernel.org>,
	"<linux-kernel@vger.kernel.org>" <linux-kernel@vger.kernel.org>,
	"Felipe Balbi" <balbi@ti.com>,
	"Lu Baolu" <baolu.lu@linux.intel.com>
Subject: Re: [PATCH] usb: ulpi: don't register drivers if bus doesn't exist
Date: Wed, 27 May 2015 10:05:19 +0530	[thread overview]
Message-ID: <20150527043519.GA3096@sudip-PC> (raw)
In-Reply-To: <20150527024118.GD7038@kroah.com>

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 <gregkh@linuxfoundation.org> 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

  reply	other threads:[~2015-05-27  4:35 UTC|newest]

Thread overview: 30+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-05-20 19:33 [PATCH] usb: ulpi: don't register drivers if bus doesn't exist Sasha Levin
2015-05-20 21:22 ` David Cohen
2015-05-21  6:39   ` Lu, Baolu
2015-05-21  7:21     ` Heikki Krogerus
2015-05-22 10:16       ` Heikki Krogerus
2015-05-22 10:52         ` Heikki Krogerus
2015-05-22 14:21         ` Sasha Levin
2015-05-24  7:19 ` Greg KH
2015-05-24  8:09   ` Sudip Mukherjee
2015-05-24 14:30     ` Tal Shorer
2015-05-25 11:40       ` Heikki Krogerus
2015-05-25 16:13         ` Greg KH
2015-05-25 17:00           ` Bjørn Mork
2015-05-26 17:54             ` David Cohen
2015-05-27  2:41               ` Greg KH
2015-05-27  4:35                 ` Sudip Mukherjee [this message]
2015-05-27 16:49                 ` David Cohen
2015-05-27  2:39             ` Greg KH
2015-05-27  8:39           ` Heikki Krogerus
2015-05-27  9:05             ` Sudip Mukherjee
2015-05-27 15:16             ` Alan Stern
2015-05-27 15:21               ` Greg KH
2015-05-28  5:39                 ` Sudip Mukherjee
2015-05-28  5:54                   ` Felipe Balbi
2015-05-28  6:42                     ` Sudip Mukherjee
2015-05-28  6:53                       ` Sudip Mukherjee
2015-05-28 15:57                     ` Alan Stern
2015-05-28 12:36                   ` Sasha Levin
2015-05-28 13:24                     ` Heikki Krogerus
2015-05-28 16:23                   ` Greg KH

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20150527043519.GA3096@sudip-PC \
    --to=sudipm.mukherjee@gmail.com \
    --cc=balbi@ti.com \
    --cc=baolu.lu@linux.intel.com \
    --cc=bjorn@mork.no \
    --cc=david.a.cohen@linux.intel.com \
    --cc=gregkh@linuxfoundation.org \
    --cc=heikki.krogerus@linux.intel.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-usb@vger.kernel.org \
    --cc=sasha.levin@oracle.com \
    --cc=tal.shorer@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox