[Intel-gfx] [PATCH] drm/i915/guc: Replace %phn with %phN

Chris Wilson chris at chris-wilson.co.uk
Tue Apr 10 11:10:10 UTC 2018


Quoting Michal Wajdeczko (2018-04-10 11:57:03)
> On Tue, 10 Apr 2018 11:14:35 +0200, Chris Wilson  
> <chris at chris-wilson.co.uk> wrote:
> 
> > %phn is not a valid specifier,
> 
> Well, implementation allows that as alias for default separator ;)
> 
>         switch (fmt[1]) {
>         case 'C':
>                 separator = ':';
>                 break;
>         case 'D':
>                 separator = '-';
>                 break;
>         case 'N':
>                 separator = 0;
>                 break;
>         default:
>                 separator = ' ';
>                 break;
>         }
> 
> > so I presume %phN was meant for an
> > encoded hex string with no separator
> 
> No, default ' ' separator is desired as it is more readable:
> 
> [] writing 05 45 00 00 00 34 a2 0d 40 00 00 00 01 00 00 00
> vs
> [] writing 054500000034a20d4000000001000000
> 
> > (and not that the hex string should
> > be followed by the letter 'n'!).
> 
> 'n' was never added to the output, as it was consumed by fmt specifier ;)
> 
> >
> > drivers/gpu/drm/i915/intel_guc_ct.c:616 ctb_read() warn: '%ph' cannot be  
> > followed by 'n'
> > drivers/gpu/drm/i915/intel_guc_ct.c:616 ctb_read() warn: '%ph' cannot be  
> > followed by 'n'
> > drivers/gpu/drm/i915/intel_guc_ct.c:616 ctb_read() warn: '%ph' cannot be  
> > followed by 'n'
> > drivers/gpu/drm/i915/intel_guc_ct.c:669 ct_handle_response() warn: '%ph'  
> > cannot be followed by 'n'
> > drivers/gpu/drm/i915/intel_guc_ct.c:679 ct_handle_response() warn: '%ph'  
> > cannot be followed by 'n'
> > drivers/gpu/drm/i915/intel_guc_ct.c:693 ct_handle_response() warn: '%ph'  
> > cannot be followed by 'n'
> > drivers/gpu/drm/i915/intel_guc_ct.c:707 ct_handle_response() warn: '%ph'  
> > cannot be followed by 'n'
> > drivers/gpu/drm/i915/intel_guc_ct.c:727 ct_process_request() warn: '%ph'  
> > cannot be followed by 'n'
> > drivers/gpu/drm/i915/intel_guc_ct.c:803 ct_handle_request() warn: '%ph'  
> > cannot be followed by 'n'
> 
> hmm, I can't see these warnings, how to get them?

The extended format specifiers are known to smatch. I shall keep
prodding to his this included it the litany of checkpatch tools. It has
a higher false positive than say gcc, but not so high as checkpatch ;)

But when it finds a bug, it is invaluable.

> > Signed-off-by: Chris Wilson <chris at chris-wilson.co.uk>
> > Cc: Michal Wajdeczko <michal.wajdeczko at intel.com>
> > Cc: Daniele Ceraolo Spurio <daniele.ceraolospurio at intel.com>
> 
> with s/%phN/%ph

Ok, will respin.
-Chris


More information about the Intel-gfx mailing list