lkml.org 
[lkml]   [2018]   [Feb]   [16]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
From
Date
SubjectRe: [PATCH 02/12] usb: typec: Start using ERR_PTR
On Fri, Feb 16, 2018 at 12:47 PM, Hans de Goede <hdegoede@redhat.com> wrote:
> From: Heikki Krogerus <heikki.krogerus@linux.intel.com>
>
> In order to allow the USB Type-C Class driver take care of
> things like muxes and other possible dependencies for the
> port drivers, returning ERR_PTR instead of NULL from the
> registration functions in case of failure.
>
> The reason for taking over control of the muxes for example
> is because handling them in the port drivers would be just
> boilerplate.

> void typec_unregister_altmode(struct typec_altmode *alt)
> {
> - if (alt)
> - device_unregister(&alt->dev);
> + device_unregister(&alt->dev);
> }

But it's a pattern to guarantee that unregister type of functions are
NULL (or ERR_PTR) aware.


> void typec_unregister_partner(struct typec_partner *partner)
> {
> - if (partner)
> - device_unregister(&partner->dev);
> + device_unregister(&partner->dev);
> }

Ditto.

--
With Best Regards,
Andy Shevchenko

\
 
 \ /
  Last update: 2018-02-16 12:08    [W:0.195 / U:1.520 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site