On Tue, Sep 17, 2019 at 09:02:54AM -0400, Steven Rostedt wrote: > On Tue, 17 Sep 2019 09:52:16 +0200 > Petr Mladek <pmla...@suse.com> wrote: > > > Heh, I did some grepping and the return value is actually used on > > three locations: > > > > $> git grep "= printk(" > > drivers/scsi/aic7xxx/aic79xx_core.c: printed = printk("%s[0x%x]", > > name, value); > > drivers/scsi/aic7xxx/aic79xx_core.c: printed += printk(" "); > > drivers/scsi/aic7xxx/aic79xx_core.c: printed += > > printk("%s%s", > > drivers/scsi/aic7xxx/aic79xx_core.c: printed += printk(") "); > > drivers/scsi/aic7xxx/aic79xx_core.c: printed += printk(" "); > > drivers/scsi/aic7xxx/aic79xx_core.c: cur_col = printk("\n%3d > > FIFO_USE[0x%x] ", SCB_GET_TAG(scb), > > drivers/scsi/aic7xxx/aic79xx_core.c: cur_col += > > printk("SHADDR = 0x%x%x, SHCNT = 0x%x ", > > drivers/scsi/aic7xxx/aic79xx_core.c: cur_col += > > printk("HADDR = 0x%x%x, HCNT = 0x%x ", > > drivers/scsi/aic7xxx/aic7xxx_core.c: printed = printk("%s[0x%x]", > > name, value); > > drivers/scsi/aic7xxx/aic7xxx_core.c: printed += printk(" "); > > drivers/scsi/aic7xxx/aic7xxx_core.c: printed += > > printk("%s%s", > > drivers/scsi/aic7xxx/aic7xxx_core.c: printed += printk(") "); > > drivers/scsi/aic7xxx/aic7xxx_core.c: printed += printk(" "); > > drivers/scsi/aic7xxx/aic7xxx_core.c: cur_col = > > printk("\n%3d ", i); > > drivers/scsi/aic7xxx/aic7xxx_core.c: cur_col = > > printk("\n%3d ", scb->hscb->tag);
All of those can be removed as none of the returned values are used. What a mess. > > drivers/scsi/libsas/sas_ata.c: r = printk("%s" SAS_FMT "ata%u: %s: > > %pV", return value is also ignored, this can be fixed. > > kernel/locking/lockdep.c: len += printk("%*s %s", > > depth, "", usage_str[bit]); > > kernel/locking/lockdep.c: len += printk(KERN_CONT " > > at:\n"); That seems to be the only semi-legitimate use, but if it _really_ needs it, it can just create the string ahead of time, and use the length then after it printks it out. > > It is probably not a big deal. For example, lockdep uses the value > > just for formatting (extra spaces) when printing backtrace. > > > > I agree that it does not make sense to return the value if it > > complicates the code too much. Well, we will need to count > > the string length also from another reason (reservation). > > Well, it's being used. I was thinking of dropping it if it was not. > Let's keep it then. I think it should be dropped, only one user of the kernel is using it in a legitimate way, which kind of implies it isn't needed. thanks, greg k-h