linux-wireless.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Johan Hovold <johan@kernel.org>
To: Dan Carpenter <dan.carpenter@oracle.com>
Cc: johan@kernel.org, linux-wireless@vger.kernel.org
Subject: Re: [bug report] NFC: fix broken device allocation
Date: Fri, 7 Jul 2017 20:32:22 +0200	[thread overview]
Message-ID: <20170707183222.GF29638@localhost> (raw)
In-Reply-To: <20170707093334.zhnn3jrtqosbqdib@mwanda>

On Fri, Jul 07, 2017 at 12:33:34PM +0300, Dan Carpenter wrote:
> Hello Johan Hovold,
> 
> The patch 20777bc57c34: "NFC: fix broken device allocation" from Mar
> 30, 2017, leads to the following static checker warning:
> 
> 	drivers/nfc/pn533/pn533.c:2653 pn533_register_device()
> 	error: 'priv->nfc_dev' dereferencing possible ERR_PTR()

> drivers/nfc/pn533/pn533.c
>   2639          skb_queue_head_init(&priv->resp_q);
>   2640          skb_queue_head_init(&priv->fragment_skb);
>   2641  
>   2642          INIT_LIST_HEAD(&priv->cmd_queue);
>   2643  
>   2644          priv->nfc_dev = nfc_allocate_device(&pn533_nfc_ops, protocols,
>   2645                                             priv->ops->tx_header_len +
>   2646                                             PN533_CMD_DATAEXCH_HEAD_LEN,
>   2647                                             priv->ops->tx_tail_len);
> 
> We changed this to return error pointers as well as NULL.  When
> functions return a NULL as well as error pointers, then NULL is supposed
> to be a special case of success but here it's just a failure.  That's
> messy and bug prone.

Thanks for reporting this, Dan.

I'll take a closer look at this tomorrow, but I guess we could just
continue using NULL for all errors for now.

Thanks,
Johan

      reply	other threads:[~2017-07-07 18:32 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-07-07  9:33 [bug report] NFC: fix broken device allocation Dan Carpenter
2017-07-07 18:32 ` Johan Hovold [this message]

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=20170707183222.GF29638@localhost \
    --to=johan@kernel.org \
    --cc=dan.carpenter@oracle.com \
    --cc=linux-wireless@vger.kernel.org \
    /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;
as well as URLs for NNTP newsgroup(s).