[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CAE1zot+ENng7QE42UK9jahCcgNq6eLjKH4BMPX7OtAwHQLQnCg@mail.gmail.com>
Date: Sat, 20 Sep 2014 09:32:24 +0300
From: Octavian Purdila <octavian.purdila@...el.com>
To: Arnd Bergmann <arnd@...db.de>
Cc: Greg Kroah-Hartman <gregkh@...uxfoundation.org>,
Linus Walleij <linus.walleij@...aro.org>,
Alexandre Courbot <gnurou@...il.com>, wsa@...-dreams.de,
Samuel Ortiz <sameo@...ux.intel.com>,
Lee Jones <lee.jones@...aro.org>,
Johan Hovold <johan@...nel.org>,
Daniel Baluta <daniel.baluta@...el.com>,
Laurentiu Palcu <laurentiu.palcu@...el.com>,
linux-usb@...r.kernel.org, lkml <linux-kernel@...r.kernel.org>,
"linux-gpio@...r.kernel.org" <linux-gpio@...r.kernel.org>,
linux-i2c@...r.kernel.org
Subject: Re: [PATCH v5 4/4] gpio: add support for the Diolan DLN-2 USB GPIO driver
On Sat, Sep 20, 2014 at 5:48 AM, Arnd Bergmann <arnd@...db.de> wrote:
> On Friday 19 September 2014, Octavian Purdila wrote:
>> +struct dln2_gpio_pin {
>> + __le16 pin;
>> +} __packed;
>
> This does not need to be marked packed, since it is never embedded in another
> structure.
>
Will do.
>> +struct dln2_gpio_pin_val {
>> + __le16 pin;
>> + u8 value;
>> +} __packed;
>
> It's enough here to mark just the 'pin' member as packed.
>
OK.
>> +static int dln2_gpio_get_pin_count(struct platform_device *pdev)
>> +{
>> + int ret;
>> + __le16 count;
>> + int len = sizeof(count);
>> +
>> + ret = dln2_transfer(pdev, DLN2_GPIO_GET_PIN_COUNT, NULL, 0, &count,
>> + &len);
>
> You must not do a USB transaction on stack memory.
>
dln2_transfer allocate a new buffer (in dln2_prep_buf(), with
kmalloc()) and does the USB transfer with that buffer.
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists