Received: by 2002:a05:6358:3188:b0:123:57c1:9b43 with SMTP id q8csp433813rwd; Tue, 30 May 2023 23:51:00 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ6Glv0L/LmNP8maSr8+j9oO8TTc9RWSUDwTPjM/QlXXoM+hiru/BNquVLo3985FY9R0vlz5 X-Received: by 2002:a92:c611:0:b0:33b:dcbf:e711 with SMTP id p17-20020a92c611000000b0033bdcbfe711mr1939909ilm.8.1685515860246; Tue, 30 May 2023 23:51:00 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1685515860; cv=none; d=google.com; s=arc-20160816; b=otRmr/1Amq/NLa6ivfYfP3BSY3BIsSaLerC4UjGsZ+mKleOje9vHKX0F+XhHxS6dYy GYYY0SF18urFZgMMQTOLkwgs5uLjTIRkCJ+BULIA6srl/AyUc52cY3cufeZjq3DfvVQU 25ucd8YArwZHpBDWYXDmReu/zTHk+4VQwpgY+D9prGz5xZFyKlkqR+bubxoxBgQVAUrO jooF/flziGuwLr6KMK6OZOTijxty3AV8L5Wh4fbCxV8dNq54kvS8V6Ygz1JiwfhjHxX6 ZQmW6UDfcnM0ytB5EpEMO96V+lSmmIXBV1+yR/LGdF0l1QL+orcBmWOBnMSkNMyUBEMk V64A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:subject:message-id:date:from:in-reply-to :references:mime-version:dkim-signature; bh=MT/ursCZpYWc+U/ss5xdCpQN33pNzAamORszl4z68Ow=; b=d+XUTPzWhQOEzmBcWN8aanF6jn4ruaJzJg4cFGBJuLcrpv/lKIHSxipsri/HShQL8B AZHawotygjxO9hq/NVV67eErXkIRaf9m38OuXUay0Yz3MsCzd41i0s3bSjsrXUeaH4N7 jugw2HsSivWIEZ8AVFRC1ZDaz+ByyYoANsYxaJVsYSXzXMNqge0MAMXOMkko1UWBu1lD +D34M3K1ntTLbdM6lmkEOoES/OHKh/hiS2kNOwhYZt1HINmBI36PmgxBRrquQNg2Raoz B5+6p8KMqAtoQb/AI+RN2hl949VAT/BuhuAJkRw/IKuOSUdpufuMvsEFsNfuO29rkJ7r 4RGw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20221208 header.b=lNMtmamO; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id ja22-20020a170902efd600b001aaea258805si397340plb.134.2023.05.30.23.50.46; Tue, 30 May 2023 23:51:00 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20221208 header.b=lNMtmamO; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234145AbjEaGfg (ORCPT + 99 others); Wed, 31 May 2023 02:35:36 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:39654 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230001AbjEaGfe (ORCPT ); Wed, 31 May 2023 02:35:34 -0400 Received: from mail-ej1-x634.google.com (mail-ej1-x634.google.com [IPv6:2a00:1450:4864:20::634]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 6F48399; Tue, 30 May 2023 23:35:32 -0700 (PDT) Received: by mail-ej1-x634.google.com with SMTP id a640c23a62f3a-96f53c06babso918497666b.3; Tue, 30 May 2023 23:35:32 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20221208; t=1685514931; x=1688106931; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:from:to:cc:subject:date:message-id:reply-to; bh=MT/ursCZpYWc+U/ss5xdCpQN33pNzAamORszl4z68Ow=; b=lNMtmamOO2e1wvzgrMy+UcK+VWeJeCrcl3wmYu6uAry5CZ1KJz7U6Ndg/QIjGdbK1A tj/wfAIRPI/J4R2dQh4XqtrssizdRRQ4Ab2he1QAQ6UTq3xy20HiwvumCPJYTdHcrwPj QzTOJ6izHzvkT0p+Z26cuh7XqRTPEKN50JWbzcaHwvIrQG4KckxKlRIqE1oIH6yqniRT i8oK+UudyDh7A07FuNhIKjsbEh2kYKOEi/WHLpXGmPNMl/oQx7wvXzsKSaapzOTMqdYj 2I4cka+3HmgIUZqP66vK3ZvbW1EJXlg7tdrylvd9KIFyp9IC+NrfXIVqglgMUHPRTAo1 D2Ug== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1685514931; x=1688106931; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=MT/ursCZpYWc+U/ss5xdCpQN33pNzAamORszl4z68Ow=; b=AeRPOZPAwg4Q9RALsMA+OzaqiMFzo2cVxE0FijmKJWS8mTLil3sQQ3o/c+t1FsH8Hd SmJPUfToJcC+R7II5lS5EnOr0py24rnNtTehBdVg30UCC488XKNKx2HWOz+ZuWvrER2c C9WbOp17AGOsJAcrGJA5GKoLWJHUMRD0aQ8IAgErXO8ZQIm4aJtrx9Suj63iz7hifSZ+ B0lNA7LbG6/R5DQeyswaQmflZfl+8LDuHWvKOyduplGAWKghXTFeO1NRO+E/z2UOBiYu qnn7uc3SgWWW3/QEsj9zltP0LCHWGRCybtn7/cr4yl0IbXO/cD5dDObSbHK8MTJtPOpM y5CQ== X-Gm-Message-State: AC+VfDwBuEnYWUIYyONKy+loMzr6cWA3IkwdeD7lhYSjmnuKfYahyo0A YLlhYlsWp+JRgDN2CSjKmRKZr3P/lO2+5p0L5OsmfS7eDl0= X-Received: by 2002:a17:907:d16:b0:960:ddba:e5c3 with SMTP id gn22-20020a1709070d1600b00960ddbae5c3mr4616805ejc.32.1685514930685; Tue, 30 May 2023 23:35:30 -0700 (PDT) MIME-Version: 1.0 References: <20230530154252.7895-1-osmtendev@gmail.com> In-Reply-To: <20230530154252.7895-1-osmtendev@gmail.com> From: David Rheinsberg Date: Wed, 31 May 2023 08:35:18 +0200 Message-ID: Subject: Re: [PATCH v2] hid-wiimote-debug.c: Drop error checking for debugfs_create_file To: Osama Muhammad Cc: jikos@kernel.org, benjamin.tissoires@redhat.com, linux-input@vger.kernel.org, linux-kernel@vger.kernel.org Content-Type: text/plain; charset="UTF-8" X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_FROM, RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE, URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi On Tue, 30 May 2023 at 17:43, Osama Muhammad wrote: > > This patch removes the error checking for debugfs_create_file > in hid-wiimote-debug.c.c. This is because the debugfs_create_file() > does not return NULL but an ERR_PTR after an error. > The DebugFS kernel API is developed in a way that the > caller can safely ignore the errors that occur during > the creation of DebugFS nodes.The debugfs Api handles > it gracefully. The check is unnecessary. > > Link to the comment above debugfs_create_file: > https://elixir.bootlin.com/linux/latest/source/fs/debugfs/inode.c#L451 > > Signed-off-by: Osama Muhammad Looks good, thanks! Reviewed-by: David Rheinsberg Thanks David > --- > changes since v1 > -In v1 the IS_ERR was used for error checking which is dropped now. > --- > drivers/hid/hid-wiimote-debug.c | 10 ---------- > 1 file changed, 10 deletions(-) > > diff --git a/drivers/hid/hid-wiimote-debug.c b/drivers/hid/hid-wiimote-debug.c > index a99dcca2e099..00f9be55f148 100644 > --- a/drivers/hid/hid-wiimote-debug.c > +++ b/drivers/hid/hid-wiimote-debug.c > @@ -173,7 +173,6 @@ int wiidebug_init(struct wiimote_data *wdata) > { > struct wiimote_debug *dbg; > unsigned long flags; > - int ret = -ENOMEM; > > dbg = kzalloc(sizeof(*dbg), GFP_KERNEL); > if (!dbg) > @@ -183,13 +182,9 @@ int wiidebug_init(struct wiimote_data *wdata) > > dbg->eeprom = debugfs_create_file("eeprom", S_IRUSR, > dbg->wdata->hdev->debug_dir, dbg, &wiidebug_eeprom_fops); > - if (!dbg->eeprom) > - goto err; > > dbg->drm = debugfs_create_file("drm", S_IRUSR, > dbg->wdata->hdev->debug_dir, dbg, &wiidebug_drm_fops); > - if (!dbg->drm) > - goto err_drm; > > spin_lock_irqsave(&wdata->state.lock, flags); > wdata->debug = dbg; > @@ -197,11 +192,6 @@ int wiidebug_init(struct wiimote_data *wdata) > > return 0; > > -err_drm: > - debugfs_remove(dbg->eeprom); > -err: > - kfree(dbg); > - return ret; > } > > void wiidebug_deinit(struct wiimote_data *wdata) > -- > 2.34.1 >