linux-input.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Dan Carpenter <dan.carpenter@oracle.com>
To: Benjamin Tissoires <benjamin.tissoires@redhat.com>
Cc: Jiri Kosina <jkosina@suse.cz>,
	Nestor Lopez Casado <nlopezcasad@logitech.com>,
	linux-input@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH 1/2] HID: logitech-hidpp: fix negated returns
Date: Mon, 3 Nov 2014 23:32:30 +0300	[thread overview]
Message-ID: <20141103203230.GV6890@mwanda> (raw)
In-Reply-To: <1415044253-18734-1-git-send-email-benjamin.tissoires@redhat.com>

On Mon, Nov 03, 2014 at 02:50:52PM -0500, Benjamin Tissoires wrote:
> @@ -524,8 +541,11 @@ static int hidpp_touchpad_get_raw_info(struct hidpp_device *hidpp,
>  	ret = hidpp_send_fap_command_sync(hidpp, feature_index,
>  		CMD_TOUCHPAD_GET_RAW_INFO, NULL, 0, &response);
>  
> -	if (ret)
> -		return -ret;
> +	if (ret > 0) {
> +		hid_err(hidpp->hid_dev, "%s: received protocol error 0x%02x\n",
> +			__func__, ret);
> +		return -EPROTO;
> +	}

We should handle -ENOMEM and -EINVAL here as well.  Something like:

	if (ret > 0) {
		hid_err(hidpp->hid_dev, "%s: received protocol error 0x%02x\n",
		        __func__, ret);
		ret = -EPROTO;
	}
	if (ret)
		return ret;

regards,
dan carpenter

  parent reply	other threads:[~2014-11-03 20:32 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-11-03 19:50 [PATCH 1/2] HID: logitech-hidpp: fix negated returns Benjamin Tissoires
2014-11-03 19:50 ` [PATCH 2/2] HID: logitech-hidpp: 2 fixes in hidpp_root_get_protocol_version() Benjamin Tissoires
2014-11-03 20:32 ` Dan Carpenter [this message]
2014-11-03 20:41   ` [PATCH 1/2] HID: logitech-hidpp: fix negated returns Benjamin Tissoires

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=20141103203230.GV6890@mwanda \
    --to=dan.carpenter@oracle.com \
    --cc=benjamin.tissoires@redhat.com \
    --cc=jkosina@suse.cz \
    --cc=linux-input@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=nlopezcasad@logitech.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;
as well as URLs for NNTP newsgroup(s).