Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1431380 > unrolled thread
| Started by | Nicolas Iooss <nicolas.iooss_linux@m4x.org> |
|---|---|
| First post | 2016-06-26 10:30 +0200 |
| Last post | 2016-06-28 04:00 +0200 |
| Articles | 2 — 2 participants |
Back to article view | Back to linux.kernel
[PATCH 1/1] usb: dwc2: add printf attribute to cat_printf() Nicolas Iooss <nicolas.iooss_linux@m4x.org> - 2016-06-26 10:30 +0200
Re: [PATCH 1/1] usb: dwc2: add printf attribute to cat_printf() John Youn <John.Youn@synopsys.com> - 2016-06-28 04:00 +0200
| From | Nicolas Iooss <nicolas.iooss_linux@m4x.org> |
|---|---|
| Date | 2016-06-26 10:30 +0200 |
| Subject | [PATCH 1/1] usb: dwc2: add printf attribute to cat_printf() |
| Message-ID | <rOdC1-m6-1@gated-at.bofh.it> |
As cat_printf() uses printf format strings in its parameters, adding
__printf attribute allows the compiler to detect at compile-time some
errors related to format strings (with -Wformat warning flag).
Signed-off-by: Nicolas Iooss <nicolas.iooss_linux@m4x.org>
---
drivers/usb/dwc2/hcd_queue.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/drivers/usb/dwc2/hcd_queue.c b/drivers/usb/dwc2/hcd_queue.c
index b5c7793a2df2..13754353251f 100644
--- a/drivers/usb/dwc2/hcd_queue.c
+++ b/drivers/usb/dwc2/hcd_queue.c
@@ -367,7 +367,8 @@ static void pmap_unschedule(unsigned long *map, int bits_per_period,
* @fmt: The format for printf.
* @...: The args for printf.
*/
-static void cat_printf(char **buf, size_t *size, const char *fmt, ...)
+static __printf(3, 4)
+void cat_printf(char **buf, size_t *size, const char *fmt, ...)
{
va_list args;
int i;
--
2.9.0
[toc] | [next] | [standalone]
| From | John Youn <John.Youn@synopsys.com> |
|---|---|
| Date | 2016-06-28 04:00 +0200 |
| Message-ID | <rOQtH-8uA-3@gated-at.bofh.it> |
| In reply to | #1431380 |
On 6/26/2016 1:12 AM, Nicolas Iooss wrote:
> As cat_printf() uses printf format strings in its parameters, adding
> __printf attribute allows the compiler to detect at compile-time some
> errors related to format strings (with -Wformat warning flag).
>
> Signed-off-by: Nicolas Iooss <nicolas.iooss_linux@m4x.org>
> ---
> drivers/usb/dwc2/hcd_queue.c | 3 ++-
> 1 file changed, 2 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/usb/dwc2/hcd_queue.c b/drivers/usb/dwc2/hcd_queue.c
> index b5c7793a2df2..13754353251f 100644
> --- a/drivers/usb/dwc2/hcd_queue.c
> +++ b/drivers/usb/dwc2/hcd_queue.c
> @@ -367,7 +367,8 @@ static void pmap_unschedule(unsigned long *map, int bits_per_period,
> * @fmt: The format for printf.
> * @...: The args for printf.
> */
> -static void cat_printf(char **buf, size_t *size, const char *fmt, ...)
> +static __printf(3, 4)
> +void cat_printf(char **buf, size_t *size, const char *fmt, ...)
> {
> va_list args;
> int i;
>
Acked-by: John Youn <johnyoun@synopsys.com>
John
[toc] | [prev] | [standalone]
Back to top | Article view | linux.kernel
csiph-web