public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Borislav Petkov <bp@alien8.de>
To: Medad Young <medadyoung@gmail.com>, Paul Menzel <pmenzel@molgen.mpg.de>
Cc: rric@kernel.org, James Morse <james.morse@arm.com>,
	tony.luck@intel.com, Mauro Carvalho Chehab <mchehab@kernel.org>,
	Rob Herring <robh+dt@kernel.org>,
	Benjamin Fair <benjaminfair@google.com>,
	Nancy Yuen <yuenn@google.com>,
	Patrick Venture <venture@google.com>,
	KWLIU@nuvoton.com, YSCHU@nuvoton.com, JJLIU0@nuvoton.com,
	KFTING <KFTING@nuvoton.com>, Avi Fishman <avifishman70@gmail.com>,
	Tomer Maimon <tmaimon77@gmail.com>,
	Tali Perry <tali.perry1@gmail.com>,
	ctcchien@nuvoton.com, devicetree <devicetree@vger.kernel.org>,
	OpenBMC Maillist <openbmc@lists.ozlabs.org>,
	Linux Kernel Mailing List <linux-kernel@vger.kernel.org>,
	linux-edac <linux-edac@vger.kernel.org>
Subject: Re: [PATCH v6 3/3] EDAC: nuvoton: Add NPCM memory controller driver
Date: Thu, 14 Apr 2022 10:42:32 +0200	[thread overview]
Message-ID: <YlfeXVSkUC2B4xH2@zn.tnic> (raw)
In-Reply-To: <CAHpyw9fQVbS1Cpv0ULQc2=vK8LsG6n7tgP+J9AboUupDAPT27Q@mail.gmail.com>

On Thu, Apr 14, 2022 at 09:55:05AM +0800, Medad Young wrote:
> > > +                             if (mtype == MEM_TYPE_DDR4)
> > > +                                     dimm->mtype = MEM_DDR4;
> > > +                             else
> > > +                                     dimm->mtype = MEM_EMPTY;
> >
> > Use ternary operator?
> >
> >      dimm-mtype = (mtype == MEM_TYPE_DDR4) ? MEM_DDR4 : MEM_EMPTY;

Ternary operator is less readable than a plain and simple if-else.

> > > +{
> > > +     struct priv_data *priv = mci->pvt_info;
> > > +     const struct npcm_edac_platform_data *npcm_chip = priv->npcm_chip;
> > > +     u64 err_c_addr = 0x0;
> >
> > size_t
> 
> OK

Why is size_t? error address doesn't have anything to do with a
sizeof(), array indexing or loop counting.

It is an error address and having it in an u64 tells you exactly what
its quantity is.

So can we stop the silliness pls?

> > > +static irqreturn_t edac_ecc_isr(int irq, void *dev_id)
> > > +{
> > > +     struct mem_ctl_info *mci = dev_id;
> > > +     struct priv_data *priv = mci->pvt_info;
> > > +     const struct npcm_edac_platform_data *npcm_chip = priv->npcm_chip;
> > > +     u32 intr_status;
> > > +     u32 val;
> > > +
> > > +     /* Check the intr status and confirm ECC error intr */
> > > +     intr_status = readl(priv->reg + npcm_chip->ecc_ctl_int_status);
> > > +
> > > +     edac_dbg(3, "InterruptStatus : 0x%x\n", intr_status);
> >
> > Remove the space before the colon? Maybe use:
> >
> > "Interrupt status (intr_status): 0x%x\n"

And repeat "interrupt status"? Also silly. The question to ask
yourselves should always be: is this error message helpful enough to its
intended recipients.

When I see

  "Interrupt status (intr_status): 0x%x\n"

in my code, I go: "hm, where does this message come from?" because it
ain't helpful enough. So I have to go stare at the code too.

I hope you're catching my drift.

-- 
Regards/Gruss,
    Boris.

https://people.kernel.org/tglx/notes-about-netiquette

  reply	other threads:[~2022-04-14  8:42 UTC|newest]

Thread overview: 23+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-03-22  3:01 [PATCH v6 0/3] EDAC: nuvoton: Add nuvoton NPCM memory controller driver Medad CChien
2022-03-22  3:01 ` [PATCH v6 1/3] ARM: dts: nuvoton: Add memory controller node Medad CChien
2022-04-08 17:02   ` Borislav Petkov
2022-04-09  5:57   ` Paul Menzel
2022-04-11  7:56     ` Medad Young
2022-04-11  8:12       ` Paul Menzel
2022-03-22  3:01 ` [PATCH v6 2/3] dt-bindings: edac: nuvoton: add NPCM memory controller Medad CChien
2022-03-23 15:56   ` Rob Herring
2022-04-08 17:05   ` Borislav Petkov
2022-04-11  7:57     ` Medad Young
2022-04-11  8:21       ` Borislav Petkov
2022-04-09  6:12   ` Paul Menzel
2022-04-11  8:01     ` Medad Young
2022-03-22  3:01 ` [PATCH v6 3/3] EDAC: nuvoton: Add NPCM memory controller driver Medad CChien
2022-04-08 19:04   ` Borislav Petkov
2022-04-11  8:06     ` Medad Young
2022-04-09  7:08   ` Paul Menzel
2022-04-14  1:55     ` Medad Young
2022-04-14  8:42       ` Borislav Petkov [this message]
2022-04-14  8:56         ` Paul Menzel
2022-04-14 10:15           ` Borislav Petkov
2022-04-14 10:44             ` Paul Menzel
2022-04-14 11:38               ` Borislav Petkov

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=YlfeXVSkUC2B4xH2@zn.tnic \
    --to=bp@alien8.de \
    --cc=JJLIU0@nuvoton.com \
    --cc=KFTING@nuvoton.com \
    --cc=KWLIU@nuvoton.com \
    --cc=YSCHU@nuvoton.com \
    --cc=avifishman70@gmail.com \
    --cc=benjaminfair@google.com \
    --cc=ctcchien@nuvoton.com \
    --cc=devicetree@vger.kernel.org \
    --cc=james.morse@arm.com \
    --cc=linux-edac@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mchehab@kernel.org \
    --cc=medadyoung@gmail.com \
    --cc=openbmc@lists.ozlabs.org \
    --cc=pmenzel@molgen.mpg.de \
    --cc=robh+dt@kernel.org \
    --cc=rric@kernel.org \
    --cc=tali.perry1@gmail.com \
    --cc=tmaimon77@gmail.com \
    --cc=tony.luck@intel.com \
    --cc=venture@google.com \
    --cc=yuenn@google.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox