All of lore.kernel.org
 help / color / mirror / Atom feed
From: Andrzej Hajda <a.hajda@samsung.com>
To: Darren Hart <dvhart@infradead.org>
Cc: linux-kernel@vger.kernel.org,
	Bartlomiej Zolnierkiewicz <b.zolnierkie@samsung.com>,
	Marek Szyprowski <m.szyprowski@samsung.com>,
	Mattia Dongili <malattia@linux.it>,
	platform-driver-x86@vger.kernel.org
Subject: Re: [PATCH 14/19] sony-laptop: fix handling sony_nc_hotkeys_decode result
Date: Mon, 05 Oct 2015 09:42:53 +0200	[thread overview]
Message-ID: <561229FD.9010308@samsung.com> (raw)
In-Reply-To: <20151003163932.GB110874@vmdeb7>

On 10/03/2015 06:39 PM, Darren Hart wrote:
> On Thu, Sep 24, 2015 at 04:00:22PM +0200, Andrzej Hajda wrote:
>> The function can return negative value.
>>
>> The problem has been detected using proposed semantic patch
>> scripts/coccinelle/tests/assign_signed_to_unsigned.cocci [1].
>>
>> [1]: http://permalink.gmane.org/gmane.linux.kernel/2046107
>>
>> Signed-off-by: Andrzej Hajda <a.hajda@samsung.com>
> Sorry for the delay Andrsej, and thank you for your patch. Given my delay, I've
> made a couple of changes myself rather than asking you to resubmit. Please
> review and let me know if you have any concerns.

Looks OK. Thanks for fixing.

Regards
Andrzej

>
> First, The description above is incomplete and relies on context from the URL
> to fully explain the problem you are fixing. In the future, please ensure the
> commit message is self-sufficient.
>
> I have changed the message to read:
>
>     sony-laptop: Fix handling sony_nc_hotkeys_decode result
>
>     sony_nv_hotkeys_decode can return a negative value. real_ev is a u32 variable.
>     The check for real_ev > 0 is incorrect.
>
>     Use an intermediate ret variable.
>
>     The problem has been detected using proposed semantic patch
>     scripts/coccinelle/tests/assign_signed_to_unsigned.cocci [1].
>
>     [1]: http://permalink.gmane.org/gmane.linux.kernel/2046107
>
>     Signed-off-by: Andrzej Hajda <a.hajda@samsung.com>
>     [dvhart: clarify commit msg, drop superfluous else block]
>     Signed-off-by: Darren Hart <dvhart@linux.intel.com>
>
> See below for an additional change.
>
>> ---
>> Hi,
>>
>> To avoid problems with too many mail recipients I have sent whole
>> patchset only to LKML. Anyway patches have no dependencies.
>>
>> Regards
>> Andrzej
>> ---
>>  drivers/platform/x86/sony-laptop.c | 12 ++++++++----
>>  1 file changed, 8 insertions(+), 4 deletions(-)
>>
>> diff --git a/drivers/platform/x86/sony-laptop.c b/drivers/platform/x86/sony-laptop.c
>> index aeb80d1..d8a2115 100644
>> --- a/drivers/platform/x86/sony-laptop.c
>> +++ b/drivers/platform/x86/sony-laptop.c
>> @@ -1204,6 +1204,8 @@ static void sony_nc_notify(struct acpi_device *device, u32 event)
>>  {
>>  	u32 real_ev = event;
>>  	u8 ev_type = 0;
>> +	int ret;
>> +
>>  	dprintk("sony_nc_notify, event: 0x%.2x\n", event);
>>  
>>  	if (event >= 0x90) {
>> @@ -1225,13 +1227,15 @@ static void sony_nc_notify(struct acpi_device *device, u32 event)
>>  		case 0x0100:
>>  		case 0x0127:
>>  			ev_type = HOTKEY;
>> -			real_ev = sony_nc_hotkeys_decode(event, handle);
>> +			ret = sony_nc_hotkeys_decode(event, handle);
>>  
>> -			if (real_ev > 0)
>> -				sony_laptop_report_input_event(real_ev);
>> -			else
>> +			if (ret > 0) {
>> +				sony_laptop_report_input_event(ret);
>> +				real_ev = ret;
>> +			} else {
>>  				/* restore the original event for reporting */
>>  				real_ev = event;
>> +			}
> This 4 line else block is superfluous. real_ev is initialized to event and only changed here if ret > 0. Therefore, there is no need to set real_ev to event again. I have simply dropped the else block
>

  reply	other threads:[~2015-10-05  7:43 UTC|newest]

Thread overview: 53+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-09-24 14:00 [PATCH 00/19] Fixes related to incorrect assignment of signed results function Andrzej Hajda
2015-09-24 14:00 ` [PATCH 01/19] SUNRPC: fix variable type Andrzej Hajda
2015-09-25 20:25   ` J. Bruce Fields
2015-09-25 20:25     ` J. Bruce Fields
     [not found] ` <1443103227-25612-1-git-send-email-a.hajda-Sze3O3UU22JBDgjK7y7TUQ@public.gmane.org>
2015-09-24 14:00   ` [PATCH 02/19] spi: davinci: fix handling platform_get_irq result Andrzej Hajda
2015-09-24 14:00     ` Andrzej Hajda
     [not found]     ` <1443103227-25612-3-git-send-email-a.hajda-Sze3O3UU22JBDgjK7y7TUQ@public.gmane.org>
2015-09-25 18:09       ` Applied "spi: davinci: fix handling platform_get_irq result" to the spi tree Mark Brown
2015-09-24 14:00 ` [PATCH 03/19] libata: samsung_cf: fix handling platform_get_irq result Andrzej Hajda
2015-09-24 14:53   ` Tejun Heo
2015-09-25  6:43     ` [PATCH v2 " Andrzej Hajda
2015-09-25 15:50       ` Tejun Heo
2015-09-24 14:00 ` [PATCH 04/19] v4l: omap3isp: " Andrzej Hajda
2015-11-09 20:16   ` Laurent Pinchart
2015-11-10  6:48     ` Andrzej Hajda
2015-11-10  8:53       ` Laurent Pinchart
2015-11-10  9:59         ` Andrzej Hajda
2015-09-24 14:00 ` [PATCH 05/19] media: am437x-vpfe: " Andrzej Hajda
2015-09-24 14:00 ` [PATCH 06/19] staging: media: omap4iss: " Andrzej Hajda
2015-09-24 15:07   ` Dan Carpenter
2015-09-24 14:00 ` [PATCH 07/19] net: hisilicon: " Andrzej Hajda
2015-09-27  5:47   ` David Miller
2015-09-24 14:00 ` [PATCH 08/19] clk: st: fix handling result of of_property_count_strings Andrzej Hajda
2015-10-01 22:23   ` Stephen Boyd
2015-09-24 14:00 ` [PATCH 09/19] dmaengine: xgene-dma: fix handling xgene_dma_get_ring_size result Andrzej Hajda
2015-09-25  2:09   ` Vinod Koul
2015-09-24 14:00 ` [PATCH 10/19] cx231xx: fix handling cx231xx_read_i2c_data result Andrzej Hajda
2015-09-24 14:00 ` [PATCH 11/19] clocksource: fix __ftm_clk_init result Andrzej Hajda
2015-12-14 10:34   ` Andrzej Hajda
2015-12-14 13:27     ` Daniel Lezcano
2015-09-24 14:00 ` [PATCH 12/19] extcon: rt8973a: fix handling regmap_irq_get_virq result Andrzej Hajda
2015-09-24 23:40   ` Chanwoo Choi
2015-09-24 14:00 ` [PATCH 13/19] extcon: sm5502: " Andrzej Hajda
2015-09-24 23:40   ` Chanwoo Choi
2015-09-24 14:00 ` [PATCH 14/19] sony-laptop: fix handling sony_nc_hotkeys_decode result Andrzej Hajda
2015-10-03 16:39   ` Darren Hart
2015-10-05  7:42     ` Andrzej Hajda [this message]
2015-09-24 14:00 ` [PATCH 15/19] KVM: PPC: e500: fix handling local_sid_lookup result Andrzej Hajda
2015-09-24 14:00   ` Andrzej Hajda
2015-09-24 22:58   ` Scott Wood
2015-09-24 22:58     ` Scott Wood
2015-10-15  5:30   ` Paul Mackerras
2015-10-15  5:30     ` Paul Mackerras
2015-09-24 14:00 ` [PATCH 16/19] r8169: fix handling rtl_readphy result Andrzej Hajda
2015-09-27  5:48   ` David Miller
2015-09-24 14:00 ` [PATCH 17/19] tools: bpf_jit_disasm: make get_last_jit_image return unsigned Andrzej Hajda
2015-09-24 18:53   ` Daniel Borkmann
2015-09-25  6:45     ` [PATCH v2 " Andrzej Hajda
2015-09-29  5:18       ` David Miller
2015-09-24 14:00 ` [PATCH 18/19] mac80211: make ieee80211_new_mesh_header " Andrzej Hajda
2015-09-24 14:09   ` Johannes Berg
2015-09-25  6:42     ` [PATCH v2 " Andrzej Hajda
2015-09-24 14:00 ` [PATCH 19/19] block: nvme-scsi: make nvme_trans_get_blk_desc_len " Andrzej Hajda
2015-09-24 14:00   ` Andrzej Hajda

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=561229FD.9010308@samsung.com \
    --to=a.hajda@samsung.com \
    --cc=b.zolnierkie@samsung.com \
    --cc=dvhart@infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=m.szyprowski@samsung.com \
    --cc=malattia@linux.it \
    --cc=platform-driver-x86@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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.