linux-arm-kernel.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
From: sergei.shtylyov@cogentembedded.com (Sergei Shtylyov)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH 04/10] usb: musb: ux500: harden checks for platform data
Date: Wed, 24 Apr 2013 00:03:51 +0400	[thread overview]
Message-ID: <5176E927.908@cogentembedded.com> (raw)
In-Reply-To: <1366729394-11406-5-git-send-email-lee.jones@linaro.org>

Hello.

On 04/23/2013 07:03 PM, Lee Jones wrote:

> In its current state, the ux500-musb driver uses platform data pointers
> blindly with no prior checking. If no platform data pointer is passed
> this will Oops the kernel. In this patch we ensure platform data and
> board data are present prior to using them.
>
> Cc: Felipe Balbi <balbi@ti.com>
> Cc: linux-usb at vger.kernel.org
> Signed-off-by: Lee Jones <lee.jones@linaro.org>
> ---
>   drivers/usb/musb/ux500_dma.c |   11 ++++++++---
>   1 file changed, 8 insertions(+), 3 deletions(-)
>
> diff --git a/drivers/usb/musb/ux500_dma.c b/drivers/usb/musb/ux500_dma.c
> index c75e07a..02b4a6e 100644
> --- a/drivers/usb/musb/ux500_dma.c
> +++ b/drivers/usb/musb/ux500_dma.c
> @@ -287,7 +287,7 @@ static int ux500_dma_controller_start(struct dma_controller *c)
>   	struct musb *musb = controller->private_data;
>   	struct device *dev = musb->controller;
>   	struct musb_hdrc_platform_data *plat = dev->platform_data;
> -	struct ux500_musb_board_data *data = plat->board_data;
> +	struct ux500_musb_board_data *data;
>   	struct dma_channel *dma_channel = NULL;
>   	u32 ch_num;
>   	u8 dir;
> @@ -297,14 +297,19 @@ static int ux500_dma_controller_start(struct dma_controller *c)

[...]

>   
>   	/* Prepare the loop for RX channels */
>   	channel_array = controller->rx_channel;
> -	param_array = data->dma_rx_param_array;
> +	param_array = (data) ? data->dma_rx_param_array : NULL;

    Why enclose a simple variable in parens?

>   
>   	for (dir = 0; dir < 2; dir++) {
>   		for (ch_num = 0;
> @@ -337,7 +342,7 @@ static int ux500_dma_controller_start(struct dma_controller *c)
>   
>   		/* Prepare the loop for TX channels */
>   		channel_array = controller->tx_channel;
> -		param_array = data->dma_tx_param_array;
> +		param_array = (data) ? data->dma_tx_param_array : NULL;

    Again, why?

WBR, Sergei

  reply	other threads:[~2013-04-23 20:03 UTC|newest]

Thread overview: 39+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-04-23 15:03 [PATCH 00/10] usb: musb: ux500: pathe the way for Device Tree enablement Lee Jones
2013-04-23 15:03 ` [PATCH 01/10] usb: musb: ux500: move channel number knowledge into the driver Lee Jones
2013-04-25 13:01   ` Linus Walleij
2013-04-23 15:03 ` [PATCH 02/10] usb: musb: ux500: move the MUSB HDRC configuration " Lee Jones
2013-04-25 13:02   ` Linus Walleij
2013-04-23 15:03 ` [PATCH 03/10] usb: musb: ux500: take the dma_mask from coherent_dma_mask Lee Jones
2013-04-25 13:04   ` Linus Walleij
2013-04-23 15:03 ` [PATCH 04/10] usb: musb: ux500: harden checks for platform data Lee Jones
2013-04-23 20:03   ` Sergei Shtylyov [this message]
2013-04-24  6:53     ` Lee Jones
2013-04-24 14:00       ` Sergei Shtylyov
2013-04-24 14:26         ` Felipe Balbi
     [not found]           ` <CAF2Aj3ga7R3Vti4YB-83T_AsanB3iL34aysAN3MiMWZBvB=z2Q@mail.gmail.com>
2013-04-24 14:56             ` Arnd Bergmann
2013-04-24 15:04   ` [PATCH 04/10 v2] " Lee Jones
2013-04-25 13:06     ` Linus Walleij
2013-04-23 15:03 ` [PATCH 05/10] usb: musb: ux500: attempt to find channels by name before using pdata Lee Jones
2013-04-24 15:05   ` [PATCH 05/10 v2] " Lee Jones
2013-04-25 13:08     ` Linus Walleij
2013-04-23 15:03 ` [PATCH 06/10] usb: musb: ux500: add device tree probing support Lee Jones
2013-04-23 15:14   ` Arnd Bergmann
2013-04-23 15:15     ` Felipe Balbi
2013-04-23 15:27       ` Arnd Bergmann
2013-04-23 15:29         ` Felipe Balbi
2013-04-24  7:43   ` [PATCH 06/10 v2] " Lee Jones
2013-04-25 13:12     ` Linus Walleij
2013-04-23 15:03 ` [PATCH 07/10] ARM: ux500: Add an auxdata entry for MUSB for clock-name look-up Lee Jones
2013-04-25 13:13   ` Linus Walleij
2013-04-23 15:03 ` [PATCH 08/10] ARM: ux500: Populate the ux500-musb Device Tree entry Lee Jones
2013-04-24  7:41   ` [PATCH 08/10 v2] " Lee Jones
2013-04-25 13:14     ` Linus Walleij
2013-04-23 15:03 ` [PATCH 09/10] ARM: ux500: Remove ux500-musb platform registation when booting with DT Lee Jones
2013-04-25 13:15   ` Linus Walleij
2013-05-02 10:52   ` Lee Jones
2013-04-23 15:03 ` [PATCH 10/10] ARM: ux500: Remove empty function u8500_of_init_devices() Lee Jones
2013-04-25 13:16   ` Linus Walleij
2013-05-02 10:52   ` Lee Jones
2013-04-23 15:16 ` [PATCH 00/10] usb: musb: ux500: pathe the way for Device Tree enablement Arnd Bergmann
2013-04-26 13:49 ` Fabio Baltieri
2013-04-26 15:19   ` Lee Jones

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=5176E927.908@cogentembedded.com \
    --to=sergei.shtylyov@cogentembedded.com \
    --cc=linux-arm-kernel@lists.infradead.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).