Received: by 10.223.176.5 with SMTP id f5csp763019wra; Sat, 3 Feb 2018 09:42:55 -0800 (PST) X-Google-Smtp-Source: AH8x224+qpOb0ETDKcXZ7PIPwF9WnI3+fWrZt3fJ2g2s9RqbZGGrQkpvHH5x9lUIGGjkzMXtlU8x X-Received: by 10.98.105.199 with SMTP id e190mr43127823pfc.233.1517679775557; Sat, 03 Feb 2018 09:42:55 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1517679775; cv=none; d=google.com; s=arc-20160816; b=J6X8ZNHVVMdqz9lPV2Pnjw9kWKFBarwBGcByuxwsqV2Dg0yWS0vrTz4JrW48jTvPts 1Zz0seyxYvQCgeJccr4j9Dz58WIf2aGseXXsTkwabdlRr88KKUoaDwOSJQ5Jf6yOlsT3 MqWoHreVTun6OB6LdTNCLd/U0Ii8SBrFNmzfyVsm6cJrBpWpJs3WFTIF5vpcI7P1ux3i wxe05RzjS1Y4Wg4oCNVpYQsJGT2TGM+UKHN7DVf4vvpfKWcHBuXnDcqU7CxD2PMWyerd 88nAvgBP1KiaLnK8uJjovUCxhOc+2ONx83GSSLEwaKl8ptsY30MnTgsPmOTv8eWXtN5f 8woA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding :content-language:in-reply-to:mime-version:user-agent:date :message-id:references:cc:to:from:subject:arc-authentication-results; bh=gAoB/SpZhuB6KXTPKt7xyGhmg71iVliga5n5WEbIKqc=; b=VP9mlCNGUwFZkuDkqHt6GTu1Y0mxVorH97um+UaY66jMIFCJIufmZTW1kEqe40pfDg IQIQ/gM5pjAPoLX1emS5cqhcjKLRBk8CmOxmI7XaUbow0KBUYGskeTG/EPkA39tchxRf 9d97FIBz4OmA6gZw5vO7FjgjWUHmcq0tuwkycKIiSyxKpgqTCDtjwN1w8wNI577JIP4M hS+/EttL94hc2H5ggUIH1ntOvfyzr6LWQ8on2Fvrh1RnUGazpnYwUuWyDpbhbnBYLNBj cbWKB9EAowDDveb0uCLCyJIFvyCRmjrri/hwnbZaLYvQu4vJ2WTNMcrwUeQwcpRpRz// danw== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=QUARANTINE sp=NONE dis=NONE) header.from=sourceforge.net Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id b1-v6si4017390pls.421.2018.02.03.09.42.40; Sat, 03 Feb 2018 09:42:55 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=QUARANTINE sp=NONE dis=NONE) header.from=sourceforge.net Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752753AbeBCRkM (ORCPT + 99 others); Sat, 3 Feb 2018 12:40:12 -0500 Received: from mout.web.de ([212.227.17.11]:47175 "EHLO mout.web.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752604AbeBCRkF (ORCPT ); Sat, 3 Feb 2018 12:40:05 -0500 Received: from [192.168.1.2] ([77.181.226.140]) by smtp.web.de (mrweb102 [213.165.67.124]) with ESMTPSA (Nemesis) id 0MCqoJ-1eZSw93HSl-009hl6; Sat, 03 Feb 2018 18:39:58 +0100 Subject: [PATCH 3/6] hid-prodikeys: Move an assignment in pk_probe() From: SF Markus Elfring To: linux-input@vger.kernel.org, Benjamin Tissoires , Jiri Kosina Cc: LKML , kernel-janitors@vger.kernel.org References: Message-ID: <44c2767f-c66c-3b36-4bd1-059d5d2f4461@users.sourceforge.net> Date: Sat, 3 Feb 2018 18:39:58 +0100 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.6.0 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 8bit X-Provags-ID: V03:K0:h3jvNAV47FYrnofI/3q7mApIqEJNE2mzaf93PhY1W+QjZ9YFJGO cLUY+PYt0t5DOnA2I4kM4tWYOYic+La3s4dkJ8agsKT29h2s6RrQ64TyGBwa0APYbx9E+8M gKIksFqE7Kj0fTIGLvC6WvYJIwefLSJ/GjQ1xJscHSKbdLbUIUz6jBuTcbtOc/QykjYfYwN f1RehE+qoaTB1l23doFJw== X-UI-Out-Filterresults: notjunk:1;V01:K0:Oj/x0T0zxBQ=:jkUt7t8MFzPbm3sFscReW8 9s747qqGvdrpbeZT5VDXLdOQHR7m3pBO0qUk3DTztq4i591zm6rulnwqhNanFyQQJ9/CY1f5C MAZxlC/4VswQYFRDn3tjJTYVK++p+WK88/Y2yFllGqx6ytaq/UOPq4DKkTK3+RY8x3k067fBX a9F7yleoSh0d5PrgtstYE25qtoonJNOqecei2tOg2cRRNEWJ5jUaJ4XFsQHoGMzKN1AxP4hTg OxK6aiOpV6noRbxGMamPJEhm4TT10cifVos6TF7/vHNA2p2pIeLmuZ9UFW1Q4fwGXZXnDFYqj T/QvDBx+AYe0vtfMWWqE+j135/Nh+18VBEy71aXsRSj565ZWlpOxRM8BHSjn1STRjbiHibPyB WXZ8+9P+X3H39tP9VerUcb89LKpJe2dkKXJ6umurGKVaq4hB0RuvsdceBgQUjzAQSc9F98Tjh eV0gmkbf8oV0I+qxzrvk9ygKukmJTAYZ/B+BlIUkrtziees3qSRPGOcCT9vFfYfvQIBj2z4C7 a9HBYvkcmcJKx5ncNI7Iyj6vJ18iVRiRlwdlNkXoCQ86QWSdGgX/svFnwNbyAUukXL68SwRrF pkQ517eJLJnV6p01qjo9oclv50cwXfX7gfXORdmwMKYH5BlqManrgR3oEZizolzR+mBcoI2J/ OfuLAP6AUJ+r994ohs2DqQMQ+Bxm6cLsIE+7ehHyjet775td92eEf2a3wFT4aNXtdgJShdfHW v3ivyFcSjLmIbZpyyTBBUA3aMFw+w1zmQrxcS8rjux1uPMxu9oW/frMitnSXB34mTuoc5KQkW Xt1CNM8qDjgB3Ex3IZjj5DHnmjOSDqMkIZfqoyUH50IujO44Pg= Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Markus Elfring Date: Sat, 3 Feb 2018 17:20:01 +0100 Move one assignment for a data structure member in one local variable so that its setting will only be performed after a corresponding memory allocation succeeded by this function. Signed-off-by: Markus Elfring --- drivers/hid/hid-prodikeys.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/drivers/hid/hid-prodikeys.c b/drivers/hid/hid-prodikeys.c index 2e79dfc92162..7672f723b268 100644 --- a/drivers/hid/hid-prodikeys.c +++ b/drivers/hid/hid-prodikeys.c @@ -804,8 +804,6 @@ static int pk_probe(struct hid_device *hdev, const struct hid_device_id *id) if (!pk) return -ENOMEM; - pk->hdev = hdev; - pm = kzalloc(sizeof(*pm), GFP_KERNEL); if (pm == NULL) { ret = -ENOMEM; @@ -814,6 +812,7 @@ static int pk_probe(struct hid_device *hdev, const struct hid_device_id *id) pm->pk = pk; pk->pm = pm; + pk->hdev = hdev; pm->ifnum = ifnum; hid_set_drvdata(hdev, pk); -- 2.16.1