From: Arend Van Spriel <arend.vanspriel@broadcom.com>
To: Ozgur Karatas <okaratas@member.fsf.org>,
johannes <johannes@sipsolutions.net>,
David Miller <davem@davemloft.net>
Cc: linux-wireless <linux-wireless@vger.kernel.org>,
netdev <netdev@vger.kernel.org>,
linux-kernel <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH 2/2] net: wireless: fix to uses struct
Date: Thu, 22 Dec 2016 10:37:01 +0100 [thread overview]
Message-ID: <eb612d84-a626-8bc1-bd7e-0c427489793e@broadcom.com> (raw)
In-Reply-To: <608881482358981@web17g.yandex.ru>
On 21-12-2016 23:23, Ozgur Karatas wrote:
>
> The patch fixed to struct uses in reg.c, I think doesn't need to be use to "struct".
> There is dataype not have to logical link and each is different definitons.
>
> I'm undecided on this patch. I compiled and didn't to errors.
There must be something wrong in the way you build stuff, but still just
looking at your patch it is fundamentally wrong, which is what makes
people say "do a basic C course". Let me try and explain below.
> Signed-off-by: Ozgur Karatas <okaratas@member.fsf.org>
> ---
> net/wireless/reg.c | 10 +++++-----
> 1 files changed, 5 insertions(+), 5 deletions(-)
>
> diff --git a/net/wireless/reg.c b/net/wireless/reg.c
> index 5dbac37..5b70970 100644
> --- a/net/wireless/reg.c
> +++ b/net/wireless/reg.c
> @@ -490,7 +490,7 @@ static int reg_query_builtin(const char *alpha2)
> if (!regdom)
> return -ENODATA;
>
> - request = kzalloc(sizeof(struct reg_regdb_apply_request), GFP_KERNEL);
> + request = kzalloc(sizeof(*reg_regdb_apply_request), GFP_KERNEL);
Making it more abstract to explain what you are doing:
x = foo(sizeof(T), GFP_KERNEL); where T is "struct Y".
which you change to:
x = foo(sizeof(*Y), GFP_KERNEL);
Y has no meaning for the sizeof operator and the compiler will yell at
it being an unknown identifier. In a lot of kernel code you will find:
x = foo(sizeof(*x), GFP_KERNEL);
which is probably the coding style fix you are attempting to make, but
miserably fail to do so. There is nothing linux kernel specific about
this. It is really fundamental knowledge of the C language. The correct
change for this instance is:
- request = kzalloc(sizeof(struct reg_regdb_apply_request), GFP_KERNEL);
+ request = kzalloc(sizeof(*request), GFP_KERNEL);
Hope this helps to come up with a working V2 of this patch.
Regards,
Arend
prev parent reply other threads:[~2016-12-22 9:37 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-12-21 22:23 Ozgur Karatas
2016-12-21 22:33 ` Paul Bolle
2016-12-21 22:50 ` Ozgur Karatas
2016-12-21 23:01 ` Ozgur Karatas
2016-12-21 23:06 ` Paul Bolle
2016-12-21 23:16 ` Ozgur Karatas
2016-12-22 5:18 ` kbuild test robot
2016-12-22 7:05 ` kbuild test robot
2016-12-22 9:37 ` Arend Van Spriel [this message]
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=eb612d84-a626-8bc1-bd7e-0c427489793e@broadcom.com \
--to=arend.vanspriel@broadcom.com \
--cc=davem@davemloft.net \
--cc=johannes@sipsolutions.net \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-wireless@vger.kernel.org \
--cc=netdev@vger.kernel.org \
--cc=okaratas@member.fsf.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
Powered by JetHome