Received: by 2002:ac0:a5b6:0:0:0:0:0 with SMTP id m51-v6csp1958869imm; Thu, 14 Jun 2018 06:39:03 -0700 (PDT) X-Google-Smtp-Source: ADUXVKKjzDS03LJJq6bRqTlrFka02jYwM21WT/1ouZULlqRTe1smeeuhoSiTluUfBcVM98c0D46a X-Received: by 2002:a63:8dca:: with SMTP id z193-v6mr2352341pgd.451.1528983543624; Thu, 14 Jun 2018 06:39:03 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1528983543; cv=none; d=google.com; s=arc-20160816; b=ZBonFmqLFa+Ro+rAGIZHlfnwPYU0Z/42iXOZwpeszn0mfkSgndfl5YEG2XizjH/P6f sRVmowS7TF7Y4hPXQCpVItOEVzfx/n19DikUpdM15ZcWXWUZVwDTmKbWLXmIwk+8OY1t sDWGSNXRKjdbcvNVn+fJwjYOnVUMHkYm/cLJapqruzvhTz3NXX1c0aCGjuf7AXJaSHQM 8KrypY4G9nr9ayQhYQw5DJVbnb4+vP4YAjybkiBK+fXxw3uJ7G35rgTgn4y8WWN64A+A MOo/reOjGLs63eiICTOx+N/m/8oWhqnncLg4qNhykqayWmFIbWgp8W9KPKNP75VkN/i2 nqRA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:to:references:in-reply-to:message-id:date :subject:cc:from:dkim-signature:arc-authentication-results; bh=rkptTXaXwxNifXX6oxlPFocW17y+sm5YszZBhYdOqN4=; b=j1JFbIqgAMKJb87+j8s/ajemua5D/Sa8t6HSTw9a82sfCw/8GhF2Wz04qgmr28vSKg 04F/t/Hk92jrUhuHcRmwEQhS0T2hbluub4g9DaVgilDzB2ip0mJh0ycdt5O/H9/5v/Ey cq/GeYyPpPGjWoUAgbuAqjlTAcweTw2RdffA3eHYomm1I6CBzoWFmsADOS3GkCyWFBYx 2CPTprR1sXcigzamP9GRzCo1+IQrG0QRVUFZHnnbSwS9UnY1+6/TQNNaxh5dO9D4X8pT ZnNv5D9H+nvAz+RFN/I0d5E6pR7rWv7lL/10qFqYRScI/tvOj6geg8ipTFPkvEUXxlTP fwpA== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@gmail.com header.s=20161025 header.b=DrzthGUd; 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 n21-v6si4508284pgc.229.2018.06.14.06.38.49; Thu, 14 Jun 2018 06:39:03 -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=DrzthGUd; 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 S1755345AbeFNNhZ (ORCPT + 99 others); Thu, 14 Jun 2018 09:37:25 -0400 Received: from mail-pl0-f67.google.com ([209.85.160.67]:35447 "EHLO mail-pl0-f67.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1755214AbeFNNhW (ORCPT ); Thu, 14 Jun 2018 09:37:22 -0400 Received: by mail-pl0-f67.google.com with SMTP id k1-v6so3580152plt.2; Thu, 14 Jun 2018 06:37:22 -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:in-reply-to:references; bh=rkptTXaXwxNifXX6oxlPFocW17y+sm5YszZBhYdOqN4=; b=DrzthGUdP+4k2Oy0FA0BK3t4BfViwX+f1DBK1oMVfmmViPuEh7whRwxkLStnXWxZ2r iSDetForOrWeC18XTBO0AEk3OlKor7/HykcOLkRNxxu/Nx3vobTUKvoh5+MJnL7agfsr VGgoXerzwQVC8FHRxeNFfZr1+J0EB9JgcaKWoY6GTXqWkTmtAOIc2t+Lr1aot9HfWcCm 0eA4FyORYJhHJ8p9bjPFtQW+P0SYQBRLKrB7KZ03BDfZ2zenywsZLEgzWPUQDcdaCqHv JCuRG2hULjbS/5JyOL539mP5hKrr1nsQp4vfIjXMVv/80dDF1Ofpei0fd0GKI3Ejl0on yUHg== 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:in-reply-to :references; bh=rkptTXaXwxNifXX6oxlPFocW17y+sm5YszZBhYdOqN4=; b=rocJe5vy4gLaHp84kgRcxQOZNJG+Pcvpde20QyjLS9bD0EyFHVfcpJ8bEjHOomWQ1/ Ccw7DvTl8RnKpm5lvGfb6dpnkWFAz8zeURAPxgLUr1xy+XhsRYncs0VaY+zto+llp9m2 288djCWzrnuxlJ5QhZi69Fz8+zOrU2t4kJ13nohSIXhcsuOCneAYdbJ32QCa7fgpjW1Z h4e79IbJlzLNf4azuWgaGMhxnxeDQk6tPSsesVYX3D63spuU9tghXZciXxVQwda5qzoV rCH356BX3kKUNFB+YEZD/PNw8ynjAFRJvXfGRygL8loo6cQSxMVWFNKrV/BMy/LrZY8/ EN7A== X-Gm-Message-State: APt69E2NKuDLb4x3QZxTOSgmVNNy8BuweFtw9+B+a16ew/NHQxI2aBhi rrYSY+qCzoZ0DRBr2CufDMo= X-Received: by 2002:a17:902:59ce:: with SMTP id d14-v6mr3104276plj.253.1528983442331; Thu, 14 Jun 2018 06:37:22 -0700 (PDT) Received: from localhost ([103.88.46.82]) by smtp.gmail.com with ESMTPSA id u14-v6sm9431859pfd.103.2018.06.14.06.37.21 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 14 Jun 2018 06:37:21 -0700 (PDT) From: Zhouyang Jia Cc: Zhouyang Jia , Jiri Kosina , Benjamin Tissoires , linux-input@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH v2] HID: hid-ntrig: add error handling for sysfs_create_group Date: Thu, 14 Jun 2018 21:37:17 +0800 Message-Id: <1528983437-52903-1-git-send-email-jiazhouyang09@gmail.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1528707296-35785-1-git-send-email-jiazhouyang09@gmail.com> References: <1528707296-35785-1-git-send-email-jiazhouyang09@gmail.com> 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 --- v1->v2: - Remove goto statement. --- drivers/hid/hid-ntrig.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/drivers/hid/hid-ntrig.c b/drivers/hid/hid-ntrig.c index 43b1c72..9bc6f48 100644 --- a/drivers/hid/hid-ntrig.c +++ b/drivers/hid/hid-ntrig.c @@ -955,6 +955,8 @@ 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"); return 0; err_free: -- 2.7.4