devicetree.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Peter Chen <peter.chen-KZfg59tc24xl57MIdRCFDg@public.gmane.org>
To: Michael Grzeschik <m.grzeschik-bIcnvbaLZ9MEGnE8C9+IrQ@public.gmane.org>
Cc: linux-usb-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
	linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r@public.gmane.org,
	alexander.shishkin-VuQAYsv1563Yd54FQh9/CA@public.gmane.org,
	mkl-bIcnvbaLZ9MEGnE8C9+IrQ@public.gmane.org,
	gregkh-hQyY1W1yCW8ekmWlsbkhG0B+6BGkLq7r@public.gmane.org,
	fabio.estevam-KZfg59tc24xl57MIdRCFDg@public.gmane.org,
	kernel-bIcnvbaLZ9MEGnE8C9+IrQ@public.gmane.org,
	devicetree-discuss-uLR06cmDAlY/bJ5BZ2RsiQ@public.gmane.org
Subject: Re: [PATCH v3 3/7] usb: chipidea: usbmisc: fix a potential race condition
Date: Fri, 23 Nov 2012 13:36:36 +0800	[thread overview]
Message-ID: <20121123053635.GB22420@nchen-desktop> (raw)
In-Reply-To: <1353506793-8354-4-git-send-email-m.grzeschik-bIcnvbaLZ9MEGnE8C9+IrQ@public.gmane.org>

On Wed, Nov 21, 2012 at 03:06:29PM +0100, Michael Grzeschik wrote:
> From: Marc Kleine-Budde <mkl-bIcnvbaLZ9MEGnE8C9+IrQ@public.gmane.org>
> 
> This fixes a potential race condition where the ci13xxx_imx glue code
> could be fast enough to call one of the usbmisc_ops before he got a
> valid value on the static usbmisc pointer. To fix that we first set
> usbmisc, then call usbmisc_set_ops().

usbmisc is subsys_initcall, and cil13xxx_imx is module_init. Any
potential situation that the ci13xxx_imx's probe is ran before the
usbmisc's probe is completed? Besides, there is usbmisc_ops value
check at the beginning of cil13xxx_imx's probe.
> 
> Signed-off-by: Marc Kleine-Budde <mkl-bIcnvbaLZ9MEGnE8C9+IrQ@public.gmane.org>
> Signed-off-by: Michael Grzeschik <m.grzeschik-bIcnvbaLZ9MEGnE8C9+IrQ@public.gmane.org>
> ---
> Changes since v1:
> * split previous patch into two seperate.
> 
>  drivers/usb/chipidea/usbmisc_imx.c |    4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/usb/chipidea/usbmisc_imx.c b/drivers/usb/chipidea/usbmisc_imx.c
> index 552c63f..9145e04 100644
> --- a/drivers/usb/chipidea/usbmisc_imx.c
> +++ b/drivers/usb/chipidea/usbmisc_imx.c
> @@ -116,14 +116,14 @@ static int __devinit usbmisc_imx_probe(struct platform_device *pdev)
>  		return ret;
>  	}
>  
> +	usbmisc = data;
>  	ret = usbmisc_set_ops(&imx6q_usbmisc_ops);
>  	if (ret) {
> +		usbmisc = NULL;
>  		clk_disable_unprepare(data->clk);
>  		return ret;
>  	}
>  
> -	usbmisc = data;
> -
>  	return 0;
>  }
>  
> -- 
> 1.7.10.4
> 
> --
> To unsubscribe from this list: send the line "unsubscribe linux-usb" in
> the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html
> 

-- 

Best Regards,
Peter Chen

--
To unsubscribe from this list: send the line "unsubscribe linux-usb" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

  parent reply	other threads:[~2012-11-23  5:36 UTC|newest]

Thread overview: 27+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-11-21 14:06 [PATCH v3 0/7] support other fsl SoCs with usbmisc + small fixes Michael Grzeschik
     [not found] ` <1353506793-8354-1-git-send-email-m.grzeschik-bIcnvbaLZ9MEGnE8C9+IrQ@public.gmane.org>
2012-11-21 14:06   ` [PATCH v3 1/7] usb: chipidea: usbmisc: rename file, struct and functions to usbmisc_imx Michael Grzeschik
2012-11-21 14:06   ` [PATCH v3 2/7] usb: chipidea: usbmisc: unset global varibale usbmisc on driver remove Michael Grzeschik
2012-11-21 14:06   ` [PATCH v3 3/7] usb: chipidea: usbmisc: fix a potential race condition Michael Grzeschik
     [not found]     ` <1353506793-8354-4-git-send-email-m.grzeschik-bIcnvbaLZ9MEGnE8C9+IrQ@public.gmane.org>
2012-11-23  5:36       ` Peter Chen [this message]
2012-11-23  7:37         ` Sascha Hauer
     [not found]           ` <20121123073711.GJ10369-bIcnvbaLZ9MEGnE8C9+IrQ@public.gmane.org>
2012-11-23  9:01             ` Alexander Shishkin
2012-11-23 10:00         ` Marc Kleine-Budde
2012-11-21 14:06   ` [PATCH v3 4/7] usb: chipidea: usbmisc: prepare driver to handle more than one soc Michael Grzeschik
2012-11-21 14:06   ` [PATCH v3 5/7] usb: chipidea: usbmisc: add support for ahb, ipg and per clock Michael Grzeschik
     [not found]     ` <1353506793-8354-6-git-send-email-m.grzeschik-bIcnvbaLZ9MEGnE8C9+IrQ@public.gmane.org>
2012-11-23  6:51       ` Peter Chen
2012-11-23 16:20         ` Michael Grzeschik
     [not found]           ` <20121123162051.GA31008-bIcnvbaLZ9MEGnE8C9+IrQ@public.gmane.org>
2012-11-25  9:18             ` Peter Chen
2012-11-26 15:44               ` Michael Grzeschik
2012-11-21 14:06   ` [PATCH v3 6/7] usb: chipidea: usbmisc: add mx53 support Michael Grzeschik
     [not found]     ` <1353506793-8354-7-git-send-email-m.grzeschik-bIcnvbaLZ9MEGnE8C9+IrQ@public.gmane.org>
2012-11-21 20:28       ` Sergei Shtylyov
     [not found]         ` <50AD3974.4000608-Igf4POYTYCDQT0dZR+AlfA@public.gmane.org>
2012-11-21 19:58           ` Michael Grzeschik
2012-11-23  6:53       ` Peter Chen
2012-11-23  7:39         ` Sascha Hauer
     [not found]           ` <20121123073939.GK10369-bIcnvbaLZ9MEGnE8C9+IrQ@public.gmane.org>
2012-11-25  8:05             ` Peter Chen
2012-11-23 10:02         ` Marc Kleine-Budde
     [not found]           ` <50AF49A5.6030708-bIcnvbaLZ9MEGnE8C9+IrQ@public.gmane.org>
2012-11-25  8:09             ` Peter Chen
2012-11-26 15:40               ` Grant Likely
2012-11-21 14:06   ` [PATCH v3 7/7] usb: chipidea: usbmisc: add post handling and errata fix for mx25 Michael Grzeschik
     [not found]     ` <1353506793-8354-8-git-send-email-m.grzeschik-bIcnvbaLZ9MEGnE8C9+IrQ@public.gmane.org>
2012-11-23  6:59       ` Peter Chen
2012-11-22  9:24   ` [PATCH v3 0/7] support other fsl SoCs with usbmisc + small fixes Alexander Shishkin
2012-11-22  9:31     ` Peter Chen

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=20121123053635.GB22420@nchen-desktop \
    --to=peter.chen-kzfg59tc24xl57midrcfdg@public.gmane.org \
    --cc=alexander.shishkin-VuQAYsv1563Yd54FQh9/CA@public.gmane.org \
    --cc=devicetree-discuss-uLR06cmDAlY/bJ5BZ2RsiQ@public.gmane.org \
    --cc=fabio.estevam-KZfg59tc24xl57MIdRCFDg@public.gmane.org \
    --cc=gregkh-hQyY1W1yCW8ekmWlsbkhG0B+6BGkLq7r@public.gmane.org \
    --cc=kernel-bIcnvbaLZ9MEGnE8C9+IrQ@public.gmane.org \
    --cc=linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r@public.gmane.org \
    --cc=linux-usb-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
    --cc=m.grzeschik-bIcnvbaLZ9MEGnE8C9+IrQ@public.gmane.org \
    --cc=mkl-bIcnvbaLZ9MEGnE8C9+IrQ@public.gmane.org \
    /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;
as well as URLs for NNTP newsgroup(s).