devicetree.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Mark Rutland <mark.rutland@arm.com>
To: Alex Elder <alex.elder@linaro.org>
Cc: Christian Daudt <bcm@fixthebug.org>,
	Ian Campbell <ijc+devicetree@hellion.org.uk>,
	Pawel Moll <Pawel.Moll@arm.com>,
	"rob.herring@calxeda.com" <rob.herring@calxeda.com>,
	Rob Landley <rob@landley.net>,
	Russell King <linux@arm.linux.org.uk>,
	Stephen Warren <swarren@wwwdotorg.org>,
	Mike Turquette <mturquette@linaro.org>,
	"bcm-kernel-feedback-list@broadcom.com"
	<bcm-kernel-feedback-list@broadcom.com>,
	"devicetree@vger.kernel.org" <devicetree@vger.kernel.org>,
	"linux-arm-kernel@lists.infradead.org"
	<linux-arm-kernel@lists.infradead.org>,
	"linux-doc@vger.kernel.org" <linux-doc@vger.kernel.org>,
	"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH 2/3] clk: bcm281xx: add initial clock framework support
Date: Wed, 4 Dec 2013 14:09:51 +0000	[thread overview]
Message-ID: <20131204140951.GA29200@e106331-lin.cambridge.arm.com> (raw)
In-Reply-To: <529F34D3.5080806@linaro.org>

On Wed, Dec 04, 2013 at 01:57:39PM +0000, Alex Elder wrote:
> On 12/04/2013 07:06 AM, Alex Elder wrote:
> >>> +       name_size = strlen(node->name) + 1;
> >>> >> +       ccu = kzalloc(sizeof(*ccu) + name_size, GFP_KERNEL);
> >>> >> +       if (!ccu) {
> >>> >> +               pr_err("%s: unable to map allocate CCU struct for %s\n",
> >>> >> +                       __func__, node->name);
> >>> >> +               return;
> >>> >> +       }
> >>> >> +       memcpy((char *)ccu->name, node->name, name_size);
> >> > 
> >> > You could simplify this with kstrdup.
> > You are correct, and I will make that change.  I think at
> > one point I needed the length but that doesn't appear to
> > be the case here.
> 
> On second thought, no, you may have missed what was happening here.
> I was avoiding two kmallocs() by setting aside space at the end
> of the structure to hold its name.  It may seem silly, but this
> avoids a possible (well, conceivable) failure case.

Yes, I'd misunderstood. Sorry about that.

> 
> However, based on your earlier question about "what about freeing
> ccu->name?" I am going to use kstrdup() here.  I'd rather the code
> put you at ease than look weird just to avoid an unlikely failure.

I'm happy either way.

Mark.

  reply	other threads:[~2013-12-04 14:09 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-12-04  3:54 [PATCH 0/3] clk: bcm281xx: define Broadcom kona clocks Alex Elder
2013-12-04  3:56 ` [PATCH 1/3] clk: bcm281xx: define kona clock binding Alex Elder
2013-12-04  9:39   ` Mark Rutland
2013-12-04 12:45     ` Alex Elder
2013-12-04 16:24       ` Alex Elder
2013-12-04  3:57 ` [PATCH 2/3] clk: bcm281xx: add initial clock framework support Alex Elder
2013-12-04 11:14   ` Mark Rutland
2013-12-04 13:06     ` Alex Elder
2013-12-04 13:57       ` Alex Elder
2013-12-04 14:09         ` Mark Rutland [this message]
2013-12-04  3:57 ` [PATCH 3/3] ARM: dts: bcm281xx: define real clocks Alex Elder
2013-12-04 11:19   ` Mark Rutland
2013-12-04 13:19     ` Alex Elder

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=20131204140951.GA29200@e106331-lin.cambridge.arm.com \
    --to=mark.rutland@arm.com \
    --cc=Pawel.Moll@arm.com \
    --cc=alex.elder@linaro.org \
    --cc=bcm-kernel-feedback-list@broadcom.com \
    --cc=bcm@fixthebug.org \
    --cc=devicetree@vger.kernel.org \
    --cc=ijc+devicetree@hellion.org.uk \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-doc@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux@arm.linux.org.uk \
    --cc=mturquette@linaro.org \
    --cc=rob.herring@calxeda.com \
    --cc=rob@landley.net \
    --cc=swarren@wwwdotorg.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).