Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1756322AbbKRQ02 (ORCPT ); Wed, 18 Nov 2015 11:26:28 -0500 Received: from mail-yk0-f170.google.com ([209.85.160.170]:36083 "EHLO mail-yk0-f170.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753324AbbKRQ00 convert rfc822-to-8bit (ORCPT ); Wed, 18 Nov 2015 11:26:26 -0500 MIME-Version: 1.0 In-Reply-To: <1447851356-6248-2-git-send-email-clabbe.montjoie@gmail.com> References: <1447851356-6248-1-git-send-email-clabbe.montjoie@gmail.com> <1447851356-6248-2-git-send-email-clabbe.montjoie@gmail.com> Date: Wed, 18 Nov 2015 18:26:25 +0200 Message-ID: Subject: Re: [PATCH v3 1/1] i2c: taos-evm: replace simple_strtoul by kstrtou8 From: Andy Shevchenko To: LABBE Corentin Cc: jdelvare@suse.com, Wolfram Sang , linux-i2c@vger.kernel.org, "linux-kernel@vger.kernel.org" Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8BIT Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1238 Lines: 36 On Wed, Nov 18, 2015 at 2:55 PM, LABBE Corentin wrote: > The simple_strtoul function is marked as obsolete. > This patch replace it by kstrtou8. > Only one concern. simple_strto* goes through the string until it has an invalid character or \0. In your case kstrtou8 will fail the transfer. So, is there possible cases when HW returns such data? And just a style nitpicks below. > if (p[0] == 'x') { > - data->byte = simple_strtol(p + 1, NULL, 16); > + /* > + * voluntarily dropping error code of kstrtou8 since all -> Voluntarily… > + * error code that it could return are invalid according > + * to Documentation/i2c/fault-codes -> …codes. > + */ > + if (kstrtou8(p + 1, 16, &data->byte)) > + return -EPROTO; -- With Best Regards, Andy Shevchenko -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/