Received: by 2002:ac0:a5a7:0:0:0:0:0 with SMTP id m36-v6csp2850765imm; Fri, 20 Jul 2018 06:07:05 -0700 (PDT) X-Google-Smtp-Source: AAOMgpfZdFP/kwxoDixm6VzY8+ymBjuYM3Na6eHvmlvODM9V9hcTceeABeYnGCf0QqVsLrF2ejO8 X-Received: by 2002:a63:8648:: with SMTP id x69-v6mr2055525pgd.172.1532092025468; Fri, 20 Jul 2018 06:07:05 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1532092025; cv=none; d=google.com; s=arc-20160816; b=P+VHwyIVJFo1yodUuNO3iT9gYFIEz/nqxAzTyx/89rHgYem6wAw6tDjoHlI5xR/zIS DbH1iTJ+pwnn7EZEMaShsMWjwnh9WY8Dlvv9m2cIwXB8zFWc5JK67FDuqT7KqSo/mFeA p1KYD0WsKUvLrPZDRG+IFbm4Et/NLUdOxJFzauoQRUpr1tao5PWL0uaHFRCtmt+taUA8 Tc3n5Vj6KnnQJS1IwiMFGzwngvD2hq2GY2RRYeIzf/oNP4XH3seM2CI5czG3v93LAipA BxaldwNkrRrbvhKWyypcg8r0NFwL5gYrY7zuyGd5ATcEhK5Ju8JfF2mtkE07O55ISXU5 Nh3g== 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:from:references:cc:to:subject:dkim-signature :arc-authentication-results; bh=bzI4nzqMVXT91dz2gtzq+/zbB4Vqb5/lVbAKxB2nymQ=; b=nFCtcL5ZbECtKCuJnTuN1MPv2doDq8b+ODnxkxSDcvUd3x2xgzzQpf2Vlv8wJLF5hA m0diE7x4EJH/akSQ55YzA1U8+dBLVwKzZ8j1X45D8+tGJwB3n6JMp2fopvb05g1/mv2W HwD0ToF8fZnsC74XeQPxpdbzp7FY5wUAgk1KWgDxfejVAN6kVs9e/84rfmPvBmtzClKO uYQmkffw+6rlGsY3gQu19kZZHbkHa69oMnWK6dzJyEevgWuXJTtl65OVWbD13nf7ckP6 nPum7vm6cHnwY3MtSxgjrSXh/+6NXgTA97qSxBkGO3Ag3sNHtTalT/5XzFt+8fAjkCDo dAVw== ARC-Authentication-Results: i=1; mx.google.com; dkim=temperror (no key for signature) header.i=@micronovasrl.com header.s=dkim header.b="rNRndj/+"; 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id j33-v6si1673023pld.151.2018.07.20.06.06.50; Fri, 20 Jul 2018 06:07:05 -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=temperror (no key for signature) header.i=@micronovasrl.com header.s=dkim header.b="rNRndj/+"; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1731254AbeGTNy0 (ORCPT + 99 others); Fri, 20 Jul 2018 09:54:26 -0400 Received: from mail.micronovasrl.com ([212.103.203.10]:50690 "EHLO mail.micronovasrl.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1730183AbeGTNy0 (ORCPT ); Fri, 20 Jul 2018 09:54:26 -0400 Received: from mail.micronovasrl.com (mail.micronovasrl.com [127.0.0.1]) by mail.micronovasrl.com (Postfix) with ESMTP id 79B42B009B0 for ; Fri, 20 Jul 2018 15:06:12 +0200 (CEST) Authentication-Results: mail.micronovasrl.com (amavisd-new); dkim=pass reason="pass (just generated, assumed good)" header.d=micronovasrl.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=micronovasrl.com; h=content-transfer-encoding:content-language:content-type :content-type:in-reply-to:mime-version:user-agent:date:date :message-id:from:from:references:to:subject:subject; s=dkim; t= 1532091971; x=1532955972; bh=7jn3/sOfQlBRzUAuLmkj4+GboTSWI6y14K0 VUDUMdxI=; b=rNRndj/+Y989Sr8P+XZA1mXdD7p8naeCRX+u6adtktQ5kZrylrO pnQy6m5SHtj23kw2GxUw2h4e5VoAjdrQBM7zk2cH2Ck77BeawzCQysveKOxROPER btC7IH9hfS83ch/vm4IQyfRMf3zUTR/VmdIqBwJw5rNs9X1gqIFFDMuU= X-Virus-Scanned: Debian amavisd-new at mail.micronovasrl.com X-Spam-Flag: NO X-Spam-Score: -2.9 X-Spam-Level: X-Spam-Status: No, score=-2.9 tagged_above=-10 required=4.5 tests=[ALL_TRUSTED=-1, BAYES_00=-1.9] autolearn=unavailable autolearn_force=no Received: from mail.micronovasrl.com ([127.0.0.1]) by mail.micronovasrl.com (mail.micronovasrl.com [127.0.0.1]) (amavisd-new, port 10026) with ESMTP id EFQYtI4KmZj7 for ; Fri, 20 Jul 2018 15:06:11 +0200 (CEST) Received: from [192.168.2.133] (62-11-51-166.dialup.tiscali.it [62.11.51.166]) by mail.micronovasrl.com (Postfix) with ESMTPSA id 223EBB004A5; Fri, 20 Jul 2018 15:06:11 +0200 (CEST) Subject: Re: [PATCH v9 4/4] rtc: ds1307: add frequency_test_enable sysfs attribute to check tick on m41txx To: Andy Shevchenko Cc: Alexandre Belloni , Alessandro Zummo , "open list:REAL TIME CLOCK (RTC) SUBSYSTEM" , open list References: <20180718094006.105675-1-giulio.benetti@micronovasrl.com> <20180718094006.105675-3-giulio.benetti@micronovasrl.com> <30d6b568-b785-ae93-9f56-d0a8b7e82901@micronovasrl.com> From: Giulio Benetti Message-ID: <27a1d79b-7651-4896-58f7-73ff73b14c22@micronovasrl.com> Date: Fri, 20 Jul 2018 15:06:10 +0200 User-Agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:52.0) Gecko/20100101 Thunderbird/52.9.1 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: it Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Il 20/07/2018 14:53, Andy Shevchenko ha scritto: > On Thu, Jul 19, 2018 at 9:19 PM, Giulio Benetti > wrote: >> Hi Andy, >> >> Il 18/07/2018 18:26, Andy Shevchenko ha scritto: >>> >>> On Wed, Jul 18, 2018 at 5:06 PM, Giulio Benetti >>> wrote: >>> >>>>>> + int ret; >>>>>> + >>>>>> + ret = kstrtobool(buf, &freq_test_en); >>>>>> + if (ret == -EINVAL) { >>> >>> >>>>> What kind of other error code you may expect and why they are not >>>>> considered as no error? >>> >>> >>>> According to documentation, kstrtobool can only fail with -EINVAL. >>>> See: >>>> https://elixir.bootlin.com/linux/v4.18-rc5/source/lib/kstrtox.c#L332 >>> >>> >>> That's correct. So, what do you want to show by explicitly mentioned >>> an error code in the condition? >>> >> >> So you mean I should check for negative values instead of specific error, >> right? > > Learn from the existing code. > > As you found kstrtobool() returns either 0 (no error), or -EINVAL (the > only possible error code for now). > Checking ret for non-zero is enough. > Thus, > > if (ret) { > ... > return ret; > } > > should do a job. > Oh, I was pretty sure I've found an example of kstrtobool() in the way I've used, instead no. Thanks for pointing me. I correct it. Best regards Giulio