lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <20141027143658.GB2006@localhost>
Date:	Mon, 27 Oct 2014 15:36:58 +0100
From:	Johan Hovold <johan@...nel.org>
To:	Octavian Purdila <octavian.purdila@...el.com>
Cc:	Johan Hovold <johan@...nel.org>,
	Greg Kroah-Hartman <gregkh@...uxfoundation.org>,
	Linus Walleij <linus.walleij@...aro.org>,
	Alexandre Courbot <gnurou@...il.com>,
	Wolfram Sang <wsa@...-dreams.de>,
	Samuel Ortiz <sameo@...ux.intel.com>,
	Lee Jones <lee.jones@...aro.org>,
	Arnd Bergmann <arnd@...db.de>,
	Daniel Baluta <daniel.baluta@...el.com>,
	Laurentiu Palcu <laurentiu.palcu@...el.com>,
	"linux-usb@...r.kernel.org" <linux-usb@...r.kernel.org>,
	lkml <linux-kernel@...r.kernel.org>,
	"linux-gpio@...r.kernel.org" <linux-gpio@...r.kernel.org>,
	linux-i2c <linux-i2c@...r.kernel.org>
Subject: Re: [PATCH v8 1/4] mfd: add support for Diolan DLN-2 devices

On Mon, Oct 27, 2014 at 03:21:10PM +0200, Octavian Purdila wrote:
> On Thu, Oct 23, 2014 at 6:16 PM, Johan Hovold <johan@...nel.org> wrote:
> > On Wed, Oct 15, 2014 at 05:48:08PM +0300, Octavian Purdila wrote:

> > > +struct dln2_event_cb_entry {
> > > +     struct list_head list;
> > > +     u16 id;
> > > +     struct platform_device *pdev;
> > > +     dln2_event_cb_t callback;
> > > +};
> > > +
> > > +int dln2_register_event_cb(struct platform_device *pdev, u16 id,
> > > +                        dln2_event_cb_t rx_cb)
> > > +{
> > > +     struct dln2_dev *dln2 = dev_get_drvdata(pdev->dev.parent);
> > > +     struct dln2_event_cb_entry *i, *new_cb;
> >
> > Can you use a name which does not have the same suffix as the actual
> > callback function (i.e. "_cb"). Just call it "entry" or something.
> >
> 
> OK.
> 
> > > +     unsigned long flags;
> > > +     int ret = 0;
> > > +
> > > +     new_cb = kmalloc(sizeof(*new_cb), GFP_KERNEL);
> >
> > Use kzalloc here.
> 
> Why kzalloc? All of the fields are initialized below.

It's good practise to clear any data structure at allocation. The cost
is negligible.
 
> > > +     if (!new_cb)
> > > +             return -ENOMEM;
> > > +
> > > +     new_cb->id = id;
> > > +     new_cb->callback = rx_cb;
> > > +     new_cb->pdev = pdev;
> > > +
> > > +     spin_lock_irqsave(&dln2->event_cb_lock, flags);
> > > +
> > > +     list_for_each_entry(i, &dln2->event_cb_list, list) {
> > > +             if (i->id == id) {
> > > +                     ret = -EBUSY;
> > > +                     break;
> > > +             }
> > > +     }
> > > +
> > > +     if (!ret)
> > > +             list_add_rcu(&new_cb->list, &dln2->event_cb_list);
> > > +
> > > +     spin_unlock_irqrestore(&dln2->event_cb_lock, flags);
> > > +
> > > +     if (ret)
> > > +             kfree(new_cb);
> > > +
> > > +     return ret;
> > > +}
> > > +EXPORT_SYMBOL(dln2_register_event_cb);

> > > +     ret = mfd_add_hotplug_devices(dev, dln2_devs, ARRAY_SIZE(dln2_devs));
> >
> > So this now depends on 15bb4d6e8534 ("mfd: core: Add helper function to
> > register hotplug devices") in the MFD tree.
> >
> > Please mention what tree the patch is against in your cover letter (I
> > noticed you had rebased when it no longer applied to 3.17).
> >
> > You should drop the gpiolib patch now that v3.18-rc1 is out as well.
> 
> This series is based against the Lee's for-mfd-next-v3.19 tree that
> does not yet contain the gpiolib patch.

Ok, but make sure to include that information in the cover letter.

Johan
--
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

Powered by Openwall GNU/*/Linux Powered by OpenVZ