From: Russell King - ARM Linux <linux@arm.linux.org.uk>
To: Boris BREZILLON <b.brezillon@overkiz.com>
Cc: Nicolas Ferre <nicolas.ferre@atmel.com>,
Ludovic Desroches <ludovic.desroches@atmel.com>,
Jean-Christophe Plagniol-Villard <plagnioj@jcrosoft.com>,
Alan Stern <stern@rowland.harvard.edu>,
Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
linux-usb@vger.kernel.org, linux-kernel@vger.kernel.org,
linux-arm-kernel@lists.infradead.org
Subject: Re: [PATCH v3 6/7] USB: ohci-at91: add usb_clk for transition to common clk framework
Date: Tue, 16 Jul 2013 18:07:39 +0100 [thread overview]
Message-ID: <20130716170739.GE24642@n2100.arm.linux.org.uk> (raw)
In-Reply-To: <1373988136-24622-1-git-send-email-b.brezillon@overkiz.com>
On Tue, Jul 16, 2013 at 05:22:15PM +0200, Boris BREZILLON wrote:
> @@ -41,6 +41,10 @@ extern int usb_disabled(void);
>
> static void at91_start_clock(void)
> {
> + if (uclk) {
if (!IS_ERR(uclk)) {
> + clk_set_rate(uclk, 48000000);
> + clk_prepare_enable(uclk);
> + }
> clk_prepare_enable(hclk);
> clk_prepare_enable(iclk);
> clk_prepare_enable(fclk);
> @@ -52,6 +56,8 @@ static void at91_stop_clock(void)
> clk_disable_unprepare(fclk);
> clk_disable_unprepare(iclk);
> clk_disable_unprepare(hclk);
> + if (uclk)
if (!IS_ERR(uclk))
> + clk_disable_unprepare(uclk);
> clocked = 0;
> }
>
> @@ -144,6 +150,11 @@ static int usb_hcd_at91_probe(const struct hc_driver *driver,
> goto err2;
> }
>
> + uclk = clk_get(&pdev->dev, "usb_clk");
> + if (IS_ERR(uclk)) {
> + uclk = NULL;
Remove this line.
> + dev_warn(&pdev->dev, "failed to get usb_clk\n");
> + }
> iclk = clk_get(&pdev->dev, "ohci_clk");
> if (IS_ERR(iclk)) {
> dev_err(&pdev->dev, "failed to get ohci_clk\n");
> @@ -212,10 +223,11 @@ static void usb_hcd_at91_remove(struct usb_hcd *hcd,
> release_mem_region(hcd->rsrc_start, hcd->rsrc_len);
> usb_put_hcd(hcd);
>
What if uclk is NULL here?
if (!IS_ERR(uclk))
> + clk_put(uclk);
> clk_put(hclk);
> clk_put(fclk);
> clk_put(iclk);
> - fclk = iclk = hclk = NULL;
> + fclk = iclk = hclk = uclk = NULL;
Don't.
Range of invalid struct clk pointers: those which IS_ERR(clk) returns true.
Therefore, the range of valid struct clk pointers is: _____________________
(answer on a post card, stamped and addressed to...)
next prev parent reply other threads:[~2013-07-16 17:09 UTC|newest]
Thread overview: 21+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-07-16 15:03 [PATCH v3 0/7] ARM: at91: prepare " Boris BREZILLON
2013-07-16 15:05 ` [PATCH v3 1/7] ARM: at91/tc/clocksource: replace clk_enable/disable with clk_prepare_enable/disable_unprepare Boris BREZILLON
2013-07-16 15:48 ` Daniel Lezcano
2013-07-16 15:06 ` [PATCH v3 2/7] mmc: atmel-mci: prepare clk before calling enable Boris BREZILLON
2013-07-16 15:13 ` Thomas Petazzoni
2013-07-16 15:49 ` boris brezillon
2013-07-16 17:13 ` Russell King - ARM Linux
2013-07-16 15:08 ` [PATCH v3 3/7] at91/avr32/atmel_lcdfb: " Boris BREZILLON
2013-07-16 15:10 ` [PATCH v3 4/7] USB: gadget: atmel_usba: " Boris BREZILLON
2013-07-16 15:16 ` [PATCH v3 5/7] spi: atmel: " Boris BREZILLON
2013-07-17 8:10 ` Mark Brown
2013-07-16 15:22 ` [PATCH v3 6/7] USB: ohci-at91: add usb_clk for transition to common clk framework Boris BREZILLON
2013-07-16 16:48 ` Alan Stern
2013-07-16 17:08 ` boris brezillon
2013-07-16 18:47 ` Alan Stern
2013-07-16 19:06 ` boris brezillon
2013-07-16 17:07 ` Russell King - ARM Linux [this message]
2013-07-17 15:33 ` Alan Stern
2013-07-17 15:45 ` boris brezillon
2013-07-17 16:17 ` Alan Stern
2013-07-16 15:25 ` [PATCH v3 7/7] usb: gadget: at91_udc: " Boris BREZILLON
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=20130716170739.GE24642@n2100.arm.linux.org.uk \
--to=linux@arm.linux.org.uk \
--cc=b.brezillon@overkiz.com \
--cc=gregkh@linuxfoundation.org \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-usb@vger.kernel.org \
--cc=ludovic.desroches@atmel.com \
--cc=nicolas.ferre@atmel.com \
--cc=plagnioj@jcrosoft.com \
--cc=stern@rowland.harvard.edu \
/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
all inboxes | Powered by JetHome®