From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-5.8 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI, SPF_HELO_NONE,SPF_PASS autolearn=no autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 81CAAC48BC2 for ; Wed, 23 Jun 2021 06:03:13 +0000 (UTC) Received: from phobos.denx.de (phobos.denx.de [85.214.62.61]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 2D0B9611AC for ; Wed, 23 Jun 2021 06:03:12 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 2D0B9611AC Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=denx.de Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id EFC09829B5; Wed, 23 Jun 2021 08:03:09 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=none (p=none dis=none) header.from=denx.de Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=denx.de; s=phobos-20191101; t=1624428190; bh=VmFI0er9gZ0PCvp08L1qtq8+6JvH9z6HfVqcveuDkpE=; h=To:cc:From:Subject:In-reply-to:References:Date:List-Id: List-Unsubscribe:List-Archive:List-Post:List-Help:List-Subscribe: From; b=JmzlSm/u/Tu4UBOgqqBppxsZWmVc02yUlmyQgFd3SKdm9qydW90+0R5vkq+YcN1nr 6wb+A/PXXvLg/ZwYpP+Dz2PsumLgtJaoan29M2F3NjSrWDtek8swRjMf6b0HDKR6Bi 5jZ7ioC6vhdR1QpcbFakZzXgi8rxtS6iH2IHBTej5xLsPS1KG1eqlBw4TctH7zfVKc f7gr8nKyyA5vyeo2PZfsakYrhPNvPLIceloHZ5c9V2faARx5KZrzACd0MOgV6T5lm4 vHgXiWrbXpojwn1vHNfb2Bp41SesVAND+87S0vxpOcS4MjOUglby1HrBEBpTJb8KiH PFF6fr6aSQSdA== Received: from janitor.denx.de (unknown [62.91.23.180]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) (No client certificate requested) (Authenticated sender: noc@denx.de) by phobos.denx.de (Postfix) with ESMTPSA id CFD1D800D0 for ; Wed, 23 Jun 2021 08:03:07 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=denx.de; s=phobos-20191101; t=1624428187; bh=VmFI0er9gZ0PCvp08L1qtq8+6JvH9z6HfVqcveuDkpE=; h=To:cc:From:Subject:In-reply-to:References:Date:From; b=VI0PCSfYv92M7H3dX43GegBGat6H45lk0dH/2nfVm8XEbkz1EbQQptZUL4/wZbuYu nd9IHMMlU/+VtYsekBzV75N4uFKs2XTpMspe5EhMEJj5ogIiA87GC3/+EdBQzSqi4x lt8RGagdwiHc9XmEaBXV1lbEoMk5a6GoqWy2joVeSNhY8IvGwQu6vVPZOwgGjZ0NgN oatU5/uJdQYk7mVecD4sCJDGaUUu4gr2FNZlSFkiZLk1rqEuCtpydt9j+gxIWra5Q0 R1hndGR9x29xUO7TgU43eWuJnNHyhgyb8tfqYNFESO2Lv4ehhlcJvTye6FolEKCKBM ZCIIEDED9r20A== Received: by janitor.denx.de (Postfix, from userid 108) id 8B4C0A025F; Wed, 23 Jun 2021 08:03:07 +0200 (CEST) Received: from gemini.denx.de (gemini.denx.de [10.4.0.2]) by janitor.denx.de (Postfix) with ESMTPS id 97299A003B; Wed, 23 Jun 2021 08:03:01 +0200 (CEST) Received: from gemini.denx.de (localhost [IPv6:::1]) by gemini.denx.de (Postfix) with ESMTP id 3D92424011D; Wed, 23 Jun 2021 08:03:01 +0200 (CEST) To: roland.gaudig-oss@weidmueller.com cc: u-boot@lists.denx.de, Roland Gaudig , =?UTF-8?q?Marek=20Beh=C3=BAn?= , Simon Glass From: Wolfgang Denk Subject: Re: [PATCH v1 1/1] cmd: setexpr: add dec operation for converting variable to decimal MIME-Version: 1.0 Content-type: text/plain; charset=UTF-8 Content-transfer-encoding: 8bit In-reply-to: <20210622135042.133904-2-roland.gaudig-oss@weidmueller.com> References: <20210622135042.133904-1-roland.gaudig-oss@weidmueller.com> <20210622135042.133904-2-roland.gaudig-oss@weidmueller.com> Comments: In-reply-to roland.gaudig-oss@weidmueller.com message dated "Tue, 22 Jun 2021 13:50:42 -0000." Date: Wed, 23 Jun 2021 08:03:01 +0200 Message-ID: <223201.1624428181@gemini.denx.de> X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.34 Precedence: list List-Id: U-Boot discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: u-boot-bounces@lists.denx.de Sender: "U-Boot" X-Virus-Scanned: clamav-milter 0.103.2 at phobos.denx.de X-Virus-Status: Clean Dear Roland, In message <20210622135042.133904-2-roland.gaudig-oss@weidmueller.com> you wrote: > > This patch extends the setexpr command with a dec operator to > convert an input value to decimal. ... > + /* hexadecimal to decimal conversion: "setexpr name dec value" */ > + if (argc == 4 && (strcmp(argv[2], "dec") == 0)) { > + w = cmd_get_data_size(argv[3], 4); > + a = get_arg(argv[3], w); > + return env_set_ulong(argv[1], a); > + } Should there not be a test for 4 arguments and the third _not_ being "dec" ? Like "setexpr foo hex 42" ? Best regards, Wolfgang Denk -- DENX Software Engineering GmbH, Managing Director: Wolfgang Denk HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: wd@denx.de A wise man asks himself the reason for his mistakes, while a fool will ask others.