Received: by 2002:a6b:fb09:0:0:0:0:0 with SMTP id h9csp1576487iog; Tue, 14 Jun 2022 08:43:38 -0700 (PDT) X-Google-Smtp-Source: AGRyM1uFwyRkFkG3H8JMOigikRByUngPvdhM1t3lV5Nn0t8RIkxIw0SfD2zvIJcFttf9YJBgkv66 X-Received: by 2002:a17:902:7c90:b0:167:8898:f82b with SMTP id y16-20020a1709027c9000b001678898f82bmr4937669pll.171.1655221418387; Tue, 14 Jun 2022 08:43:38 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1655221418; cv=none; d=google.com; s=arc-20160816; b=Lvdh86vy3A8VYH7aX23P38rEKf7FHAlOtR7TEMJzeNC8xg6JUaa/f7mccol29nMmk3 y6dYqpn0rLAiZrT/6waRMN5NajXBY5F3X7p8SO1r4QjPAeZXQiQyTqskUFVwvqAhV7/P bdJIB1OcAvP1jBJkN6ua8YjvF2/IeSOdKupYGL4IWtvMPJv637UxekEYeLV4RmB74Wpf e5lP3Jez8x2YjKvGBOSA96XWaSw4GbpzFIFQdqHpSNYmuUjUcL9zyRcTWvJoFv1ysJi/ ScuM4oYTOZwOcHzgQtUuh8N/me81uYL+maJmmRacUt7+Tv06YZzyBqGnuMmF32NCfClg +DFQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:cc:to:subject :message-id:date:from:reply-to:in-reply-to:references:mime-version :dkim-signature; bh=R6gek+7k8btaKHOjjow80I4o5y14I8XjWpXPB6g1/2Y=; b=ddBTLv4vmkblSYX7J4BzLRLyjgTggQRIaM+VNqz6Pz8uK84u3A++HzuKy158q3h2+J U1UY3e9V7mKyuJzhjmJebZBBwtAkaredTkLtWXC66jjjidon8Av+ZOTcqzv9JG8M+b62 P5lBYjRtj6KSp5bmKd4iUjoYjZS0c4XNMqA93ePjf+8n30Kq8HTrbo9mCFo1eQCKGxlc q92prwnyATHHXtUOgcSkFfr8jBOVhdvjIWiivxfi/fB7iZXrqUtdNtKmd3RA7W6zOhxn jC3rIdF0qTdJ6PXdEI8eBRorlZjASRrG98IyuBWBwKdTDGXRmKJ3khi5AZYyqy4v54px bimg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b=B62h3QGd; 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 a24-20020a631a58000000b0040504f9e815si14525133pgm.81.2022.06.14.08.43.26; Tue, 14 Jun 2022 08:43:38 -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=20210112 header.b=B62h3QGd; 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 S1343974AbiFNP2J (ORCPT + 99 others); Tue, 14 Jun 2022 11:28:09 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:58982 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236270AbiFNP1q (ORCPT ); Tue, 14 Jun 2022 11:27:46 -0400 Received: from mail-vs1-xe34.google.com (mail-vs1-xe34.google.com [IPv6:2607:f8b0:4864:20::e34]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id E0F9C27B04; Tue, 14 Jun 2022 08:27:43 -0700 (PDT) Received: by mail-vs1-xe34.google.com with SMTP id x187so9354259vsb.0; Tue, 14 Jun 2022 08:27:43 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=mime-version:references:in-reply-to:reply-to:from:date:message-id :subject:to:cc:content-transfer-encoding; bh=R6gek+7k8btaKHOjjow80I4o5y14I8XjWpXPB6g1/2Y=; b=B62h3QGdOCNz+CIyxl++5a3MAeWGpBpIqvE1LuIDxAiBT2KOwgQsKXMm+yXioIVHPB jjt0HWzkzU+KazGRGAzDxWR3PT8e2YZfMNNwZRjTISDAHYPOACZJXiWVcdlbj62O1iTH CRwo8tLU+5BPwTR0mx4PSFMKmNeaQFH128VbyZEXS80sLFMqOfLmOOzA8IxoLLnm8R1v HQXqYY7yI1kW48SwVZlyiRMCGRsWx44m6OPWTednk9+irfXrEil3L5JuvbC+KIUjgb7s Sv7mQHB3kSWGK1UJfXJjtiXsZawUtOKESqwxCQqrOQ56ByyQX/Ug9G+RZ1xaZgpJwVSc sYEg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:mime-version:references:in-reply-to:reply-to :from:date:message-id:subject:to:cc:content-transfer-encoding; bh=R6gek+7k8btaKHOjjow80I4o5y14I8XjWpXPB6g1/2Y=; b=EDhfSB7+NoOj7pKwu+KhQIx41dVAgqRQUZWIspAmJXXlxpVuS51qFrlkUYFWFJ7CHP 60RdPHIWtqQn6qf1AnaWu45PM2p4yD6lIK1siZhOQWU8klegAGAOMuz0tjzz5QJtXSHs ufcxtde/eXaorrfU16JkkqKTjM89Fw3wDQQi3tv8B25USD4JRb8dP/iqIqHIk3LwE2+S 7qQKPP+XbrA3yb3CRu/SZ6tYjoLqIhcOti5zRsvVXP59sY8cX25+lgo5IQzbWes5IvRD RoLtRVYVJWwmj1hSbLaBOKSmyIEDXt3bK8aeLgxpsQ4jXa25UMTTug5oUjDcXeuH/WxY VgNg== X-Gm-Message-State: AJIora8OxFStUU0P+VLaJpjmXpnPILPnFl8fyJMnccVj85gYMMvzXyxm ErVHzKK0N4YgdBYYY3ZQcNBBuYlgSXttrNgL1dw15x0q X-Received: by 2002:a67:eecb:0:b0:34b:f863:ce1b with SMTP id o11-20020a67eecb000000b0034bf863ce1bmr2411704vsp.55.1655220463027; Tue, 14 Jun 2022 08:27:43 -0700 (PDT) MIME-Version: 1.0 References: <20220613120534.36991-1-andrea.merello@iit.it> <20220613120534.36991-9-andrea.merello@iit.it> <164f663acbba481a8ea8f45f185aaf83@iit.it> In-Reply-To: Reply-To: andrea.merello@gmail.com From: Andrea Merello Date: Tue, 14 Jun 2022 17:27:32 +0200 Message-ID: Subject: Re: [v6 08/14] iio: imu: add Bosch Sensortec BNO055 core driver To: Andy Shevchenko Cc: Andrea Merello , Jonathan Cameron , Mauro Carvalho Chehab , linux-iio , Linux Kernel Mailing List , devicetree , Lars-Peter Clausen , Rob Herring , Matt Ranostay , Alexandru Ardelean , jmondi Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable 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 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 Il giorno mar 14 giu 2022 alle ore 17:11 Andy Shevchenko ha scritto: > > On Tue, Jun 14, 2022 at 2:15 PM Andrea Merello wr= ote: > > ... > > > >> >> + devm_add_action_or_reset(priv->dev, bno055_debugfs_remove= , priv->debugfs); > > >> > > > >> >Shouldn't we report the potential error here? It's not directly > > >> >related to debugfs, but something which is not directly related. > > >> > > >> The error eventually comes out from something that has nothing to do= with debugs per se (i.e. the devm stuff), but it will only affect debugfs = indeed. > > >> > > >> Assuming that we don't want to make the whole driver fail in case de= bugfs stuff fails (see last part of the comment above debugfs_create_file()= implementation), and given that the devm_add_action_or_reset(), should ind= eed "reset" in case of failure (i.e. we should be in a clean situation any= way), I would say it should be OK not to propagate the error and let things= go on. > > > > > >As I said, it's not directly related to debugfs. Here is the resource > > >leak possible or bad things happen if you probe the driver, that fails > > >to add this call for removal, remove it, and try to insert again, in > > >such case the debugfs will be stale. > > > > Hum, I would say this shouldn't ever happen: AFAICS devm_add_action_or_= reset() is a wrapper around devm_add_action() and it's purpose is exactly t= o add a check for failure; devm_add_action_or_reset() immediately invokes t= he action handler in case devm_add_action() fails. IOW in case of failure t= o add the devm stuff, the debugfs file is removed immediately and it should= n't cause any mess with next times probe()s; just the driver will go on wit= hout the debugfs file being here. > > > > I think this is the point of using devm_add_action_or_reset() instead o= f dev_add_action() indeed, or am I missing something? > > Reading that code again and I think you are right, so dev_warn() will > be sufficient to show that we fail. OTOH, what is the point of adding > a resource for the failed debugfs call? Ah, you are right here: I'll make the call to devm_add_action_or_reset() conditional to success of debugfs_create_file(). In case any of the two fails we can also warn the user. > -- > With Best Regards, > Andy Shevchenko