Received: by 2002:ac0:a5b6:0:0:0:0:0 with SMTP id m51-v6csp3803223imm; Mon, 11 Jun 2018 01:56:37 -0700 (PDT) X-Google-Smtp-Source: ADUXVKKFVqdV6rlvP1FPd/Uu6lnH1a/aNAqq6lkCvRWC6rX0Z0Trv8zPsc2zhR1eJK92+3nUYGfw X-Received: by 2002:a63:5f0c:: with SMTP id t12-v6mr13457966pgb.95.1528707397874; Mon, 11 Jun 2018 01:56:37 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1528707397; cv=none; d=google.com; s=arc-20160816; b=hShhYRRGCz8eM04vJpWHKKjeOoIwI4G88fhREHwZ5n8Gzbn9qjBJfhx6PLGchEffif 0LGPNy9+N/EkcyCqnpF5TN5EdgNaz03LlBTOVBGGIJnvRPZHKjkXEhdqY+NXYM+mp2Ri XrEwUBoP9FrjjVZwxWUMiJW0wL8kjZNXLdxhjjGhu1+Cz7Xg0LHi9VuDUcJNGgv5WHZz sxTw8dKf4mesxECjWgi8ZtvUtqJmILn29fwRvxqTjK7BwpmGZxvJ6VZYfRdw2roBuFVj EH4tQqfJ+FLzkUaLuyNZ/bq/tYOnKrRRCisRMNks2sGQAC4MqBQg5Kg+prB/BURJPz7X gMGg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:to:message-id:date:subject:cc:from :dkim-signature:arc-authentication-results; bh=Yi43wpY12A4cZ2jAu5/IWBRVrT/E1PUWJ027uoVi3Ds=; b=Uso4NFptrMnOzLP4qCAcxhmAVM6oZTyJ1GFbo44jgYUcbqYOTSl+rHvZkPr3H1Y196 ij+w/iGxX+tZaXwX22IHvS63MosFbxD5XJ6qoTxbRcX9M2jJeSbfD9yaxY/njZ/WYgdY /eL5yC0tC9QmKa7REpBLqo/b7yT04LgcGsPGCdSoE03dCI/4P+15f5WesHqHMZq3NClr IQWNnkBHLVA8ieojW0neRt4Eg7PrHoD+wP1MuYvlN7skqpg2rao1Tl4+TBdqMTVDsrP9 gus5IPbq6yy0LuiDhdhQ+LTSN/kXiNrOGC2uIRBa5OvaRchvKHQrn7jSgLBxv4icpe5Y KmFA== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@gmail.com header.s=20161025 header.b=Bp/vK3cz; 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=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id o32-v6si9398553pld.440.2018.06.11.01.56.23; Mon, 11 Jun 2018 01:56:37 -0700 (PDT) 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; dkim=fail header.i=@gmail.com header.s=20161025 header.b=Bp/vK3cz; 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=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932531AbeFKIzF (ORCPT + 99 others); Mon, 11 Jun 2018 04:55:05 -0400 Received: from mail-pg0-f65.google.com ([74.125.83.65]:36788 "EHLO mail-pg0-f65.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932272AbeFKIzE (ORCPT ); Mon, 11 Jun 2018 04:55:04 -0400 Received: by mail-pg0-f65.google.com with SMTP id m5-v6so9425484pgd.3; Mon, 11 Jun 2018 01:55:03 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id; bh=Yi43wpY12A4cZ2jAu5/IWBRVrT/E1PUWJ027uoVi3Ds=; b=Bp/vK3czP/0M6biK0Hdi7oKlpG9aInQEq5eFa9HHb/rdqex0htCSTuhSsCL3CG+Bja lc2zbv8OvZzk6bK7KMnYPw/FkWXYMlEY8YnIxUYqT4E/l8LhV48FtCE8xregHq7mNOJs zZjRZGmEibGJ/lecYd1oryyECBuX5Cu7nv0LpxrBV1npS1okFvWUN+5RKhERZP2KCnN2 zq/SVDtxWWpdt9hAhmVu7JK1FwrGSUIDldRt44ifWx8qZKORINrePPyYG9ukPThFcjAt kkcvpPFYBH77ltluHSitJ21NYUfUDE3bnO3fdpaHRUF+p6LMj9c1SQZxgEUoMtWjBZoO 9Dgw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id; bh=Yi43wpY12A4cZ2jAu5/IWBRVrT/E1PUWJ027uoVi3Ds=; b=cL+hl3ZWQZSPtyZcSEo68n0qSDYt/Qafm8pSNwX7hxE+QVBTReYX3KYUrAPONGMcRP YDZ4BoFKz8brYMOCUxKHmKoo5XYHpvE/FT+/igSMbZdzdXKszr41UdLX/+dvkXkfPWUl cnF7/BpoWIHPbKH4UBT/eX0B3+DAt7E/zVvfH+/GLAFoL52D47+K3YGWV75TP0kb/I2S c9ENUrWTEFTW2jNXl5zrj9nQCJjWCQEpecrmQtGo3NmlaNn11sD4B/cIpvAyTgZtRr+S rO4++HijiXyrVofgZERdT/GFcYIyQZkj+IbDOesv/pzJ8CX3jZhzVYZbKUsGLgz4MAq5 Uiaw== X-Gm-Message-State: APt69E1V4ALyux/OhCYjRFzv/NhWlqxcnfOC9p2kk7qKz5KnyFSMrspK LupY/9pXy5+3RV6huqEn+3E= X-Received: by 2002:a63:8b44:: with SMTP id j65-v6mr14401533pge.203.1528707303616; Mon, 11 Jun 2018 01:55:03 -0700 (PDT) Received: from localhost ([103.88.46.82]) by smtp.gmail.com with ESMTPSA id w18-v6sm14570044pgq.1.2018.06.11.01.55.02 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 11 Jun 2018 01:55:03 -0700 (PDT) From: Zhouyang Jia Cc: Zhouyang Jia , Jiri Kosina , Benjamin Tissoires , linux-input@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH] HID: hid-ntrig: add error handling for sysfs_create_group Date: Mon, 11 Jun 2018 16:54:56 +0800 Message-Id: <1528707296-35785-1-git-send-email-jiazhouyang09@gmail.com> X-Mailer: git-send-email 2.7.4 To: unlisted-recipients:; (no To-header on input) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org When sysfs_create_group fails, the lack of error-handling code may cause unexpected results. This patch adds error-handling code after calling sysfs_create_group. Signed-off-by: Zhouyang Jia --- drivers/hid/hid-ntrig.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/drivers/hid/hid-ntrig.c b/drivers/hid/hid-ntrig.c index 43b1c72..1e70dae 100644 --- a/drivers/hid/hid-ntrig.c +++ b/drivers/hid/hid-ntrig.c @@ -955,6 +955,10 @@ static int ntrig_probe(struct hid_device *hdev, const struct hid_device_id *id) ret = sysfs_create_group(&hdev->dev.kobj, &ntrig_attribute_group); + if (ret) { + hid_err(hdev, "cannot create sysfs group\n"); + goto err_free; + } return 0; err_free: -- 2.7.4