Re: [PATCH] usnic: corretly check failed allocation

From: Dave Goodell
Date: Thu Oct 15 2015 - 16:53:09 EST


On Thu, Oct 15, 2015 at 01:41:06PM -0400, Insu Yun wrote:
> On Thu, Oct 15, 2015 at 1:17 PM, Dave Goodell (dgoodell) <dgoodell@xxxxxxxxx
> > wrote:
>
> > On Oct 15, 2015, at 11:27 AM, Insu Yun <wuninsu@xxxxxxxxx> wrote:
> > >
> > > us_ibdev->ufdev = usnic_fwd_dev_alloc(dev);
> > > - if (IS_ERR_OR_NULL(us_ibdev->ufdev)) {
> > > + if (!us_ibdev->ufdev) {
> > > usnic_err("Failed to alloc ufdev for %s with err %ld\n",
> > > pci_name(dev), PTR_ERR(us_ibdev->ufdev));
> >
> > This PTR_ERR and message make less sense now.
> >
>
> Do you think what is better? removing error code? or change
> PTR_ERR(us_ibdev->ufdev)
> to -EFAULT

I would write it as:

usnic_err("Failed to alloc ufdev for %s\n", pci_name(dev));

-Dave
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/