linux-edac.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [bug report] EDAC/sifive: Add EDAC platform driver for SiFive SoCs
@ 2019-08-14 14:31 Dan Carpenter
  2019-08-20  6:11 ` Yash Shah
  0 siblings, 1 reply; 2+ messages in thread
From: Dan Carpenter @ 2019-08-14 14:31 UTC (permalink / raw)
  To: yash.shah; +Cc: linux-edac

Hello Yash Shah,

The patch 91abaeaaff35: "EDAC/sifive: Add EDAC platform driver for
SiFive SoCs" from May 6, 2019, leads to the following static checker
warning:

	drivers/edac/sifive_edac.c:60 ecc_register()
	warn: 'p->dci' can also be NULL

drivers/edac/sifive_edac.c
    43  static int ecc_register(struct platform_device *pdev)
    44  {
    45          struct sifive_edac_priv *p;
    46  
    47          p = devm_kzalloc(&pdev->dev, sizeof(*p), GFP_KERNEL);
    48          if (!p)
    49                  return -ENOMEM;
    50  
    51          p->notifier.notifier_call = ecc_err_event;
    52          platform_set_drvdata(pdev, p);
    53  
    54          p->dci = edac_device_alloc_ctl_info(0, "sifive_ecc", 1, "sifive_ecc",
    55                                              1, 1, NULL, 0,
    56                                              edac_device_alloc_index());
    57          if (IS_ERR(p->dci))
                    ^^^^^^^^^^^^^^
The edac_device_alloc_ctl_info() function never returns error pointers,
it returns NULL.

    58                  return PTR_ERR(p->dci);
    59  
    60          p->dci->dev = &pdev->dev;
    61          p->dci->mod_name = "Sifive ECC Manager";
    62          p->dci->ctl_name = dev_name(&pdev->dev);
    63          p->dci->dev_name = dev_name(&pdev->dev);
    64  

regards,
dan carpenter

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [bug report] EDAC/sifive: Add EDAC platform driver for SiFive SoCs
  2019-08-14 14:31 [bug report] EDAC/sifive: Add EDAC platform driver for SiFive SoCs Dan Carpenter
@ 2019-08-20  6:11 ` Yash Shah
  0 siblings, 0 replies; 2+ messages in thread
From: Yash Shah @ 2019-08-20  6:11 UTC (permalink / raw)
  To: Dan Carpenter; +Cc: linux-edac

On Wed, Aug 14, 2019 at 8:01 PM Dan Carpenter <dan.carpenter@oracle.com> wrote:
>
> Hello Yash Shah,
>
> The patch 91abaeaaff35: "EDAC/sifive: Add EDAC platform driver for
> SiFive SoCs" from May 6, 2019, leads to the following static checker
> warning:
>
>         drivers/edac/sifive_edac.c:60 ecc_register()
>         warn: 'p->dci' can also be NULL
>
> drivers/edac/sifive_edac.c
>     43  static int ecc_register(struct platform_device *pdev)
>     44  {
>     45          struct sifive_edac_priv *p;
>     46
>     47          p = devm_kzalloc(&pdev->dev, sizeof(*p), GFP_KERNEL);
>     48          if (!p)
>     49                  return -ENOMEM;
>     50
>     51          p->notifier.notifier_call = ecc_err_event;
>     52          platform_set_drvdata(pdev, p);
>     53
>     54          p->dci = edac_device_alloc_ctl_info(0, "sifive_ecc", 1, "sifive_ecc",
>     55                                              1, 1, NULL, 0,
>     56                                              edac_device_alloc_index());
>     57          if (IS_ERR(p->dci))
>                     ^^^^^^^^^^^^^^
> The edac_device_alloc_ctl_info() function never returns error pointers,
> it returns NULL.
>

Thanks for reporting this bug. Currently, a discussion is going on to
move this code into some other directory. The patch for the same has
been submitted [0].
I will take care of this bug once that patch is accepted.

- Yash

[0] https://lkml.org/lkml/2019/8/18/39

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2019-08-20  6:12 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-08-14 14:31 [bug report] EDAC/sifive: Add EDAC platform driver for SiFive SoCs Dan Carpenter
2019-08-20  6:11 ` Yash Shah

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).