Re: [PATCH] iommu/amd: fix missing tag from dev_err message

From: Joe Perches
Date: Tue Jul 03 2018 - 12:38:36 EST


On Tue, 2018-07-03 at 11:27 -0500, Hook, Gary wrote:
> On 7/3/2018 11:24 AM, Colin Ian King wrote:
> > On 03/07/18 17:21, Hook, Gary wrote:
> > > On 7/3/2018 10:55 AM, Joe Perches wrote:
> > > > On Tue, 2018-07-03 at 07:56 -0500, Gary R Hook wrote:
> > > > > On 07/03/2018 05:07 AM, Joe Perches wrote:
> > > > > > On Tue, 2018-07-03 at 07:40 +0100, Colin King wrote:
> > > > > > > Currently tag is being assigned but not used, it is missing from
> > > > > > > the dev_err message, so add it in.
> > > > > > >
> > > > > > > Cleans up clang warning:
> > > > > > > warning: variable 'tag' set but not used [-Wunused-but-set-variable]
> > > > > >
> > > > > > []
> > > > > > > diff --git a/drivers/iommu/amd_iommu.c b/drivers/iommu/amd_iommu.c
> > > > > >
> > > > > > []
> > > > > > > @@ -616,9 +616,9 @@ static void iommu_print_event(struct amd_iommu
> > > > > > > *iommu, void *__evt)
> > > > > > > pasid = ((event[0] >> 16) & 0xFFFF)
> > > > > > > | ((event[1] << 6) & 0xF0000);
> > > > > > > tag = event[1] & 0x03FF;
> > > > > > > - dev_err(dev, "INVALID_PPR_REQUEST device=%02x:%02x.%x
> > > > > > > pasid=0x%05x address=0x%016llx flags=0x%04x]\n",
> > > > > > > + dev_err(dev, "INVALID_PPR_REQUEST device=%02x:%02x.%x
> > > > > > > pasid=0x%05x address=0x%016llx flags=0x%04x tag=0x%03x]\n",
> > > > > > > PCI_BUS_NUM(devid), PCI_SLOT(devid), PCI_FUNC(devid),
> > > > > > > - pasid, address, flags);
> > > > > > > + pasid, address, flags, tag);
> > > > > >
> > > > > > Seems to have a superfluous ] that should be removed.
> > > > >
> > > > > Yeah, I pretty much messed up all of the log messages in that function.
> > > > > My apologies. I'll create a patch for that problem; it shouldn't be
> > > > > fixed here.
> > >
> > > Well, no, I misremembered. The extraneous square brace has been there
> > > forever. Needs fixin', though.
> > >
> >
> > The opening square bracket is much earlier:
> >
> > dev_err(dev, "AMD-Vi: Event logged [");
> >
> > ..and all the subsequent dev_err messages have the trailing square bracket.
>
> Gah! Mystery solved. I'd forgotten about that.
>
> "Never mind."
>

It stems from the misconversion from printk to dev_err

The initial dev_err is fine but all the dev_err uses
in the switch/case should use pr_cont, not dev_err

(there's a suggested patch below this commit reference)

---