All of lore.kernel.org
 help / color / mirror / Atom feed
From: mnalajal@codeaurora.org
To: Stephen Boyd <swboyd@chromium.org>
Cc: gregkh@linuxfoundation.org, rafael@kernel.org,
	linux-arm-msm@vger.kernel.org, linux-kernel@vger.kernel.org,
	bjorn.andersson@linaro.org
Subject: Re: [PATCH] base: soc: Handle custom soc information sysfs entries
Date: Thu, 03 Oct 2019 16:44:01 -0700	[thread overview]
Message-ID: <ce2f11601c3d2203069487b7bc2364d8@codeaurora.org> (raw)
In-Reply-To: <5d9682d5.1c69fb81.4efda.d786@mx.google.com>

On 2019-10-03 16:22, Stephen Boyd wrote:
> Quoting Murali Nalajala (2019-10-02 17:06:14)
>> @@ -121,6 +118,7 @@ static void soc_release(struct device *dev)
>>  struct soc_device *soc_device_register(struct soc_device_attribute 
>> *soc_dev_attr)
>>  {
>>         struct soc_device *soc_dev;
>> +       const struct attribute_group **soc_attr_groups = NULL;
> 
> Don't initialize this to NULL because it is only tested after it's been
> unconditionally assigned to the result of the allocation.
Done
> 
>>         int ret;
>> 
>>         if (!soc_bus_type.p) {
>> @@ -136,10 +134,20 @@ struct soc_device *soc_device_register(struct 
>> soc_device_attribute *soc_dev_attr
>>                 goto out1;
>>         }
>> 
>> +       soc_attr_groups = kzalloc(sizeof(*soc_attr_groups) *
> 
> Please use kcalloc() instead and drop the define for NUM_ATTR_GROUPS
> because it's used once.
> 
done
>> +                                               NUM_ATTR_GROUPS, 
>> GFP_KERNEL);
>> +       if (!soc_attr_groups) {
>> +               ret = -ENOMEM;
>> +               goto out2;
>> +       }
>> +       soc_attr_groups[0] = &soc_attr_group;
>> +       soc_attr_groups[1] = soc_dev_attr->custom_attr_group;
>> +       soc_attr_groups[2] = NULL;
> 
> Drop this assignment to NULL because kzalloc() and kcalloc() zero out
> the memory anyway.
done

      reply	other threads:[~2019-10-03 23:44 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-10-03  0:06 [PATCH] base: soc: Handle custom soc information sysfs entries Murali Nalajala
2019-10-03  7:05 ` Greg KH
2019-10-03 18:17   ` mnalajal
2019-10-03 18:28     ` Greg KH
2019-10-03  7:06 ` Greg KH
2019-10-03 18:23   ` mnalajal
2019-10-03 18:33     ` Greg KH
2019-10-03 21:11       ` mnalajal
2019-10-03 21:36         ` Bjorn Andersson
2019-10-03 23:22 ` Stephen Boyd
2019-10-03 23:44   ` mnalajal [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=ce2f11601c3d2203069487b7bc2364d8@codeaurora.org \
    --to=mnalajal@codeaurora.org \
    --cc=bjorn.andersson@linaro.org \
    --cc=gregkh@linuxfoundation.org \
    --cc=linux-arm-msm@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=rafael@kernel.org \
    --cc=swboyd@chromium.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.