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] [thread-next>] [day] [month] [year] [list]
Message-ID: <CAMuHMdXLSLsgap4ACtE0L2hOjuzGJ-HbPvGb-z-HEb55GjbntA@mail.gmail.com>
Date:   Mon, 14 Feb 2022 15:55:12 +0100
From:   Geert Uytterhoeven <geert@...ux-m68k.org>
To:     Andy Shevchenko <andriy.shevchenko@...ux.intel.com>
Cc:     Greg Kroah-Hartman <gregkh@...uxfoundation.org>,
        linux-serial@...r.kernel.org, linux-kernel@...r.kernel.org,
        Jiri Slaby <jirislaby@...nel.org>,
        Javier Martinez Canillas <javierm@...hat.com>
Subject: Re: [PATCH v1 1/2] driver core: add a wrapper to device probe log
 helper to return pointer

Hi Andy,

On Mon, Feb 14, 2022 at 3:32 PM Andy Shevchenko
<andriy.shevchenko@...ux.intel.com> wrote:
> Sometimes the ->probe() function can be split to the core and actual probe
> parts. In such cases the core one may return a pointer to the allocated
> resource, or error pointer in unsuccessful scenario. Allow that kind of
> core function to use dev_err_probe_ptr(), so the following excerpt
>
>         ret = bar(...);
>         if (ret) {
>                 dev_err_probe(dev, ret, ...);
>                 return ERR_PTR(ret);
>         }
>
> can be replaced with
>
>         ret = bar(...);
>         if (ret)
>                 return dev_err_probe_ptr(dev, ret, ...);
>
> Signed-off-by: Andy Shevchenko <andriy.shevchenko@...ux.intel.com>

Thanks for your patch!

> --- a/include/linux/device.h
> +++ b/include/linux/device.h
> @@ -14,6 +14,7 @@
>
>  #include <linux/dev_printk.h>
>  #include <linux/energy_model.h>
> +#include <linux/err.h>
>  #include <linux/ioport.h>
>  #include <linux/kobject.h>
>  #include <linux/klist.h>
> @@ -982,6 +983,13 @@ void device_links_supplier_sync_state_resume(void);
>  extern __printf(3, 4)
>  int dev_err_probe(const struct device *dev, int err, const char *fmt, ...);
>
> +/* As above, but returns error pointer */
> +static inline __printf(3, 0)
> +void *dev_err_probe_ptr(const struct device *dev, int err, const char *fmt, va_list args)

Shouldn't this be a varargs function, like dev_err_probe()?

> +{
> +       return ERR_PTR(dev_err_probe(dev, err, fmt, args));
> +}
> +
>  /* Create alias, so I can be autoloaded. */
>  #define MODULE_ALIAS_CHARDEV(major,minor) \
>         MODULE_ALIAS("char-major-" __stringify(major) "-" __stringify(minor))

Gr{oetje,eeting}s,

                        Geert

--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@...ux-m68k.org

In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say "programmer" or something like that.
                                -- Linus Torvalds

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ