Re: [PATCH v2 1/4] dev_printk: add new dev_err_probe() helpers

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Tue, Apr 23, 2024 at 05:20:30PM +0200, Nuno Sa via B4 Relay wrote:
> From: Nuno Sa <nuno.sa@xxxxxxxxxx>
> 
> This is similar to dev_err_probe() but for cases where an ERR_PTR() or
> ERR_CAST() is to be returned simplifying patterns like:
> 
> 	dev_err_probe(dev, ret, ...);
> 	return ERR_PTR(ret)
> or
> 	dev_err_probe(dev, PTR_ERR(ptr), ...);
> 	return ERR_CAST(ptr)

...

> +/* Simple helper for dev_err_probe() when ERR_PTR() is to be returned. */
> +#define dev_err_ptr_probe(dev, ___err, fmt, ...)	({		\
> +	ERR_PTR(dev_err_probe(dev, ___err, fmt, ##__VA_ARGS__));	\
> +})

Why ; and hence why ({}) ?

I even believe the compiler may warn if you have double ;; in some cases.

...

> +#define dev_err_cast_probe(dev, ___err_ptr, fmt, ...)	({			\
> +	ERR_PTR(dev_err_probe(dev, PTR_ERR(___err_ptr), fmt, ##__VA_ARGS__));	\
> +})

Ditto.

-- 
With Best Regards,
Andy Shevchenko






[Index of Archives]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Input]     [Linux Kernel]     [Linux SCSI]     [X.org]

  Powered by Linux