Received: by 2002:ac0:a5a7:0:0:0:0:0 with SMTP id m36-v6csp2836256imm; Fri, 20 Jul 2018 05:55:13 -0700 (PDT) X-Google-Smtp-Source: AAOMgpdFE+MGfi48exCKC908TO2/VXsa3dRhh3rn4xzy6T/2gKSL6hXTpMqdZ4fgui8M8c5om5D7 X-Received: by 2002:a62:5486:: with SMTP id i128-v6mr2087440pfb.166.1532091313772; Fri, 20 Jul 2018 05:55:13 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1532091313; cv=none; d=google.com; s=arc-20160816; b=sb9ipvfZnxzBmD5JNxkvrma89qY1nKsqNNtRihV4hZXuHBJCQVDyWpRV/YOm0ykXUi wL9qu7Raw4VLb7G8epRxIDybaPtLzRiMkm1vvgAkbDehnG0C64k4ZtYPHsFAptHWCQvf BsCYyQCQeq7ob0vqbeiKAz3g5dYXvQyjxg042YFBxYBQ8T9K0mSAur8ackrQXmIHleJH iw7Wv1X4jYCX9Af512LMmUiodyxH0MG2A7PMNh1QbmtxWM0FqYAmhwQroB+H5d3DAFmF wepVuO6nGBh3qwMMa44q+7K4I8+etj7LibOBmPOlAO5VC+mBVO+ZAk2BOVK/NR6xCiYc QgAA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:cc:to:subject:message-id:date:from :references:in-reply-to:mime-version:dkim-signature :arc-authentication-results; bh=W9t2cC5tAd5Yfx+Hnvbc+Z3Drj5QRCvMXmBY/TglKIk=; b=dnK04pw+rgq5VmNRQ23vkl1kbiNKv15BCyrz7t3FyR3MOpzp8uVuUFnOqQ3zaX/6tO mcNygAOOw+ojLata1Cjr6oM3rSIQ2nvJBYqulV8rBcQ4v4HkQ6+6thMap0mZfsPXAK+r l2H6edcjwxYxHXBmz/M3JiR3E9rBe5KRS9tJ66Vst2o1ztU+PLevPyIVQISajSqNBzCq ObBcdo2IoVy8/Nyoga/V5aJUQJz8uuHtUmjRdY6DBPRuzIv8c2a6OJ+Z8xzlbGvjeMO4 jCa1M9EadESD5f+F4pDIF8HrS3Ff14FfXokigKxuefoedmGHOuJcCOYR7G6gDvWUCo2R cL1g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=pf2CbeED; 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=pass (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 g15-v6si1785967pgh.418.2018.07.20.05.54.59; Fri, 20 Jul 2018 05:55:13 -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=pass header.i=@gmail.com header.s=20161025 header.b=pf2CbeED; 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=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2388907AbeGTNlw (ORCPT + 99 others); Fri, 20 Jul 2018 09:41:52 -0400 Received: from mail-vk0-f67.google.com ([209.85.213.67]:43320 "EHLO mail-vk0-f67.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1731833AbeGTNlv (ORCPT ); Fri, 20 Jul 2018 09:41:51 -0400 Received: by mail-vk0-f67.google.com with SMTP id s17-v6so6008405vke.10; Fri, 20 Jul 2018 05:53:43 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :cc; bh=W9t2cC5tAd5Yfx+Hnvbc+Z3Drj5QRCvMXmBY/TglKIk=; b=pf2CbeEDvcfyvMvygzktoCWjQ1G8mA3Im/EZIkLiItF7Wm1Z0SEFnVIqsq+t5ziEah 1i2aTqkczfPQWnC+fADzxmCAdTfLyNTe+4uzyaE7RO8oAVvO0eAZ5Ol4LrKnOpXh3csF 9Cbzxgr7H5aJpRItrN65RNfM9//DJl8hRwZU8nXIzJweMH92cnuByrqdlryxzApoojPv 1vQYZLKQXpiu6CkA8lC+1pxC6XFEQiNnCTAbLhgDtS5S8CXmGurLdHvO9UnATTpxbTyJ dL4OcI8/UDOGG2/mxVtRYb5IVqnHTBG2FWwri8TSCwOlI7wINW4xMO5FoTLTpkgvUUqd tkBQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:in-reply-to:references:from:date :message-id:subject:to:cc; bh=W9t2cC5tAd5Yfx+Hnvbc+Z3Drj5QRCvMXmBY/TglKIk=; b=qo1oZQ3ndQirJZuXUmaSgMy/MnLdgBM6Bq1LwQXoDsaikurSSpv3HuVrSdlwdHuTTs alLqVhx7naHaPMFkm3atqy6DsXNEYriTDMOGv37+WbHlZ3ekVPymy1Q9o28PceXGf7Hj 9Bj65t+panmpv9Uh826NHknu7Y7U6ASONyV1nTqvcjE3Hy/S/H31TNAkSxEJcs9rVLUR 5aI7i0fjOFiStgrpkuGC7J4Mg20LcZTh/UkWbSFWqAAJrhYxdliIK29iVdAg/vL/zEz3 Lfs+yHunr5C7wK3f8NDzyUtLMqBtmYbQ3Dgk0nYrYtKLncoB6i/cLNcN91NEMOjKSLhr xKuQ== X-Gm-Message-State: AOUpUlFmOIxQ4glfOMgUIR4L7bl4LBsarTI68ZPoZgJAs8RNAeAmKWsf kp1elVuLgtw2yUzX+KehcwHVvV+zSoStHQgZMvdP0MPx X-Received: by 2002:a1f:844e:: with SMTP id g75-v6mr1148796vkd.16.1532091222899; Fri, 20 Jul 2018 05:53:42 -0700 (PDT) MIME-Version: 1.0 Received: by 2002:a67:2149:0:0:0:0:0 with HTTP; Fri, 20 Jul 2018 05:53:42 -0700 (PDT) In-Reply-To: References: <20180718094006.105675-1-giulio.benetti@micronovasrl.com> <20180718094006.105675-3-giulio.benetti@micronovasrl.com> <30d6b568-b785-ae93-9f56-d0a8b7e82901@micronovasrl.com> From: Andy Shevchenko Date: Fri, 20 Jul 2018 15:53:42 +0300 Message-ID: Subject: Re: [PATCH v9 4/4] rtc: ds1307: add frequency_test_enable sysfs attribute to check tick on m41txx To: Giulio Benetti Cc: Alexandre Belloni , Alessandro Zummo , "open list:REAL TIME CLOCK (RTC) SUBSYSTEM" , open list Content-Type: text/plain; charset="UTF-8" Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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. -- With Best Regards, Andy Shevchenko