Re: [PATCH 07/11] NFC: pn533: improve cmd queue handling
From: Samuel Ortiz
Date: Sun May 01 2016 - 19:18:11 EST
Hi Michael,
On Thu, Apr 21, 2016 at 04:43:55PM +0200, Michael Thalmeier wrote:
> Make sure cmd is set before a frame is passed to the transport layer for
> sending. In addition pn533_send_async_complete checks if cmd is set before
> accessing its members.
>
> Signed-off-by: Michael Thalmeier <michael.thalmeier@xxxxxxx>
> ---
> drivers/nfc/pn533/pn533.c | 54 +++++++++++++++++++++++++++++------------------
> 1 file changed, 34 insertions(+), 20 deletions(-)
>
> diff --git a/drivers/nfc/pn533/pn533.c b/drivers/nfc/pn533/pn533.c
> index d9c5583..d1cc70a 100644
> --- a/drivers/nfc/pn533/pn533.c
> +++ b/drivers/nfc/pn533/pn533.c
> @@ -383,26 +383,36 @@ static void pn533_build_cmd_frame(struct pn533 *dev, u8 cmd_code,
> static int pn533_send_async_complete(struct pn533 *dev)
> {
> struct pn533_cmd *cmd = dev->cmd;
> - int status = cmd->status;
> + int rc = 0;
>
> - struct sk_buff *req = cmd->req;
> - struct sk_buff *resp = cmd->resp;
> + if (cmd) {
if (!cmd) {
dev_dbg(dev->dev, "%s: cmd not set\n", __func__);
return rc;
}
would make the rest of the code more readable.
Cheers,
Samuel.