Re: [PATCH v2] Add support for monitoring Chrome OS firmware signals

2015-12-02 Thread Martyn Welch



On 02/12/15 06:08, Jeremiah Mahler wrote:

Martyn,

On Tue, Dec 01, 2015 at 08:19:46PM +, Martyn Welch wrote:

Select Chromebooks have gpio attached to signals used to cause the firmware
to enter alternative modes of operation and/or control other device

[...]

+
+static int chromeos_firmware_probe(struct platform_device *pdev)
+{
+   int err;
+   struct chromeos_firmware_data *gpios;
+
+   gpios = devm_kmalloc(>dev, sizeof(gpios), GFP_KERNEL);


Should this be 'sizeof(*gpios)' so it allocates enough room for the
entire struct instead of just the pointer?



Yes, you're right, it should.

Martyn
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH v2] Add support for monitoring Chrome OS firmware signals

2015-12-02 Thread Martyn Welch



On 02/12/15 06:08, Jeremiah Mahler wrote:

Martyn,

On Tue, Dec 01, 2015 at 08:19:46PM +, Martyn Welch wrote:

Select Chromebooks have gpio attached to signals used to cause the firmware
to enter alternative modes of operation and/or control other device

[...]

+
+static int chromeos_firmware_probe(struct platform_device *pdev)
+{
+   int err;
+   struct chromeos_firmware_data *gpios;
+
+   gpios = devm_kmalloc(>dev, sizeof(gpios), GFP_KERNEL);


Should this be 'sizeof(*gpios)' so it allocates enough room for the
entire struct instead of just the pointer?



Yes, you're right, it should.

Martyn
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH v2] Add support for monitoring Chrome OS firmware signals

2015-12-01 Thread Jeremiah Mahler
Martyn,

On Tue, Dec 01, 2015 at 08:19:46PM +, Martyn Welch wrote:
> Select Chromebooks have gpio attached to signals used to cause the firmware
> to enter alternative modes of operation and/or control other device
[...]
> +
> +static int chromeos_firmware_probe(struct platform_device *pdev)
> +{
> + int err;
> + struct chromeos_firmware_data *gpios;
> +
> + gpios = devm_kmalloc(>dev, sizeof(gpios), GFP_KERNEL);

Should this be 'sizeof(*gpios)' so it allocates enough room for the
entire struct instead of just the pointer?

[...]

-- 
- Jeremiah Mahler
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH v2] Add support for monitoring Chrome OS firmware signals

2015-12-01 Thread Jeremiah Mahler
Martyn,

On Tue, Dec 01, 2015 at 08:19:46PM +, Martyn Welch wrote:
> Select Chromebooks have gpio attached to signals used to cause the firmware
> to enter alternative modes of operation and/or control other device
[...]
> +
> +static int chromeos_firmware_probe(struct platform_device *pdev)
> +{
> + int err;
> + struct chromeos_firmware_data *gpios;
> +
> + gpios = devm_kmalloc(>dev, sizeof(gpios), GFP_KERNEL);

Should this be 'sizeof(*gpios)' so it allocates enough room for the
entire struct instead of just the pointer?

[...]

-- 
- Jeremiah Mahler
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/