Received: by 2002:ab2:1689:0:b0:1f7:5705:b850 with SMTP id d9csp1802640lqa; Mon, 29 Apr 2024 22:25:08 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCXj4Wui14RhjhQpPP/GaahRUDYHANL7g4Bk7txB3THHF6vmdrjIOVRDehFV6v/grt/dkeuR6miHBsydMKdOT84GefCfBByv6+kjj388OQ== X-Google-Smtp-Source: AGHT+IHPEEEM/cT0rqBai2rEQRzVWb54rFIjzSk+MlBlIEATzB3bh3LbZ2n8v2SsgSZb3GM6EsL8 X-Received: by 2002:a50:bb2a:0:b0:56b:829a:38e3 with SMTP id y39-20020a50bb2a000000b0056b829a38e3mr10267361ede.16.1714454708347; Mon, 29 Apr 2024 22:25:08 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1714454708; cv=pass; d=google.com; s=arc-20160816; b=yt5n/XSvHHUb1AxXCqOE5sNuT/AGwdGC3pSFtPEo+HJn9u6fSyOQGqZQ9lTig/DKDP W49dmbF4/RaE6iaGK4U2tzy/UHoY8PHNYyVuosaorvLVgOl9/FR4LBfhDOOkW5++7Zog qHDZhQcqw3Vs16h0qh49dim9LTbQNyjugSW+pRI1V7ygsnNKnho2IRwl9/rBcM9kn5U+ Et1VIz68pxHPpYwK7fOXre3RGwHienFSiy/DJ+9UT8rE9K+jbL1tTEpygiZ93bgcr6GH dmYKOglNfR71VJeEJIFxdeMYzFK1/N6Ou6PEeJw7cfZX2MM/9ZuSgcme+Cwhb5zdm6D9 Ozsw== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:in-reply-to:autocrypt:from :content-language:references:cc:to:subject:user-agent:mime-version :list-unsubscribe:list-subscribe:list-id:precedence:date:message-id; bh=4yqirq+IhVG3Z/zsDGojXFevoBRau6B6rbnsmBlZgt0=; fh=WoBzl+tLvHiacpBBD/iB0B2qfqL+W2mV3r0KRS0wZdA=; b=ePmIjyWIBZXBglw10PwdstH7P0pHMf/fFmFEYo+dDEzk9QPzp/I9u2P8dSxgrdvz+p Vnc8F/osZGDmtQgblD9noP6W5Z9O1alOXGIH8D/iYFxRWqqB0u1XiERY4V2joFroMXIW XhAjMfM9yDgtMXO2SBLugt8DC38FBuFur06mxVwFTuUEZgb+vWuLnaDixqy5UkQBe5gY ZLCJRY5mseTOjrk75BTcMyIWQtW58CiSa5aNtAyzzaeL3IaGDUoz2kyfdZpMnZH2C8Oy gAwzfxFlu/41sfWhOMXqFwGR58Bc98XHJF3hI37t6xBSooe0sHb7/cxf1B5zmmuF3Vop WYYg==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; arc=pass (i=1 spf=pass spfdomain=gmail.com); spf=pass (google.com: domain of linux-kernel+bounces-163362-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-163362-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from am.mirrors.kernel.org (am.mirrors.kernel.org. [2604:1380:4601:e00::3]) by mx.google.com with ESMTPS id z5-20020a056402274500b00571fcccf618si11821315edd.507.2024.04.29.22.25.08 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 29 Apr 2024 22:25:08 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-163362-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) client-ip=2604:1380:4601:e00::3; Authentication-Results: mx.google.com; arc=pass (i=1 spf=pass spfdomain=gmail.com); spf=pass (google.com: domain of linux-kernel+bounces-163362-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-163362-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by am.mirrors.kernel.org (Postfix) with ESMTPS id E71AD1F2136F for ; Tue, 30 Apr 2024 05:25:07 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id CFEE017729; Tue, 30 Apr 2024 05:24:57 +0000 (UTC) Received: from mail-ed1-f42.google.com (mail-ed1-f42.google.com [209.85.208.42]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id A095F5256; Tue, 30 Apr 2024 05:24:55 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.208.42 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1714454697; cv=none; b=Dhfd8+BYpV7afHta9kSj5kSg2+mwciJ3Mz6yaQpC0qrmnbkFcl0AjrNx/05XntQ14ewFA/Ye5gTvGV3RkyA43v3zw51U5rf7gy3C3rrZy2IH/VgiuokKptlHY9Vzlzso9Z5qyQw52MfPmbs0nbG6jwIMImdYXYmMLRKIbuoyEKc= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1714454697; c=relaxed/simple; bh=Q/+tRiuXGN+EdbNSNGuhQr+t4BZW3Yq+oUqUaGly2cI=; h=Message-ID:Date:MIME-Version:Subject:To:Cc:References:From: In-Reply-To:Content-Type; b=Nuff5UEzn4iseYc0MgPQVhqYq59tykVPst8DvJzTdYR18AVEgCF18yd/Ff8yah0nk42je4YQoZ+RKnF0Arx6t7zqIF6Hl40VqDAWy60JHcANTK0Gp6EtXznEqmD4Po06uWT95Oojp27jUm79QCcw+9SF/HeF+hXeuEIq0+KCukc= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=fail (p=none dis=none) header.from=kernel.org; spf=pass smtp.mailfrom=gmail.com; arc=none smtp.client-ip=209.85.208.42 Authentication-Results: smtp.subspace.kernel.org; dmarc=fail (p=none dis=none) header.from=kernel.org Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Received: by mail-ed1-f42.google.com with SMTP id 4fb4d7f45d1cf-57230faeb81so3115720a12.0; Mon, 29 Apr 2024 22:24:55 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1714454694; x=1715059494; h=content-transfer-encoding:in-reply-to:autocrypt:from :content-language:references:cc:to:subject:user-agent:mime-version :date:message-id:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to; bh=4yqirq+IhVG3Z/zsDGojXFevoBRau6B6rbnsmBlZgt0=; b=w56GUUotB8BaVZy4mZ+p+b4GWuPXmB3A0FND/G5vXllWSliznbgbO+04wfRqC3+Ghx TVxiK3sNB0tTqJhk9nz6zajSV8XidDhVgJGl0w0Szz14mbVj5kEV1jzc5soDPbhMs24a QGlbeHQTnPWUegDUPC1hjO1ddgmOfyEtPprtOHtSdWYH9K31dqGzkbCYK2L6CbR1Pz4m fuFinr2TPa2oJ8IxOCaFnpypEhMJak8bT/rDjwVSi9wWrPArV3KibPDPU0jrqTAQEZyi 8fitubQfxtO+j8DSQ7rgtUT6cFajBTiBXTRGehLMaNy3X1716HC/V19zjz4hlMvl41mI 3Xyw== X-Forwarded-Encrypted: i=1; AJvYcCU/48SJh6+TLnpeAyPMJ0etcWpJoR/kN35otUkbecxrMdFlZAYfacyT+p6m9/7OGTUsK8Dhkz/zpjtEpMuqNhN3ETkYIstdXZ10RYOSudFJIR9u15brqVz0j2GKWiz2ywzdnBMor70nYT7QkZB8DcAbTYuKauPIrfQjqn11hWh9I0I7 X-Gm-Message-State: AOJu0YybBdxEiy/dWPYUSelAnkPuGRo8Jz4GOZPXz7opiGgZYG55CwZ3 YAYdYsE2DLdF99Vf0yGCLPCEc2LvM9u3sUfiJX0aT8l2Q9mupg3J X-Received: by 2002:a50:954b:0:b0:56e:10d3:85e3 with SMTP id v11-20020a50954b000000b0056e10d385e3mr10743116eda.13.1714454693472; Mon, 29 Apr 2024 22:24:53 -0700 (PDT) Received: from ?IPV6:2a0b:e7c0:0:107::aaaa:69? ([2a0b:e7c0:0:107::aaaa:69]) by smtp.gmail.com with ESMTPSA id t20-20020a056402021400b005728a272753sm995540edv.67.2024.04.29.22.24.52 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Mon, 29 Apr 2024 22:24:53 -0700 (PDT) Message-ID: Date: Tue, 30 Apr 2024 07:24:52 +0200 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [PATCH] serial: sc16is7xx: fix bug in sc16is7xx_set_baud() when using prescaler To: David Laight , Hugo Villeneuve , Greg Kroah-Hartman , Jon Ringle Cc: "ria.freelander@gmail.com" , Hugo Villeneuve , "stable@vger.kernel.org" , "linux-kernel@vger.kernel.org" , "linux-serial@vger.kernel.org" References: <20240426135937.3810959-1-hugo@hugovil.com> <17d2cc58-cf68-430d-9248-25abe4c5b0f0@kernel.org> <6ea689ace38d47f285efe026772efcae@AcuMS.aculab.com> Content-Language: en-US From: Jiri Slaby Autocrypt: addr=jirislaby@kernel.org; keydata= xsFNBE6S54YBEACzzjLwDUbU5elY4GTg/NdotjA0jyyJtYI86wdKraekbNE0bC4zV+ryvH4j rrcDwGs6tFVrAHvdHeIdI07s1iIx5R/ndcHwt4fvI8CL5PzPmn5J+h0WERR5rFprRh6axhOk rSD5CwQl19fm4AJCS6A9GJtOoiLpWn2/IbogPc71jQVrupZYYx51rAaHZ0D2KYK/uhfc6neJ i0WqPlbtIlIrpvWxckucNu6ZwXjFY0f3qIRg3Vqh5QxPkojGsq9tXVFVLEkSVz6FoqCHrUTx wr+aw6qqQVgvT/McQtsI0S66uIkQjzPUrg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jhn/sVIhNmEBLBoI7PL+9fbILqJPHgAwW35rpnq4f/EYTykbk1sa13Tav6btJ+4QOgbcezWI wZ5w/JVfEJW9JXp3BFAVzRQ5nVrrLDAJZ8Y5ioWcm99JtSIIxXxt9FJaGc1Bgsi5K/+dyTKL wLMJgiBzbVx8G+fCJJ9YtlNOPWhbKPlrQ8+AY52Aagi9WNhe6XfJdh5g6ptiOILm330mkR4g W6nEgZVyIyTq3ekOuruftWL99qpP5zi+eNrMmLRQx9iecDNgFr342R9bTDlb1TLuRb+/tJ98 f/bIWIr0cqQmqQ33FgRhrG1+Xml6UXyJ2jExmlO8JljuOGeXYh6ZkIEyzqzffzBLXZCujlYQ DFXpyMNVJ2ZwPmX2mWEoYuaBU0JN7wM+/zWgOf2zRwhEuD3A2cO2PxoiIfyUEfB9SSmffaK/ S4xXoB6wvGENZ85Hg37C7WDNdaAt6Xh2uQIly5grkgvWppkNy4ZHxE+jeNsU7tg= In-Reply-To: <6ea689ace38d47f285efe026772efcae@AcuMS.aculab.com> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit On 29. 04. 24, 11:14, David Laight wrote: > From: Jiri Slaby >> Sent: 29 April 2024 07:39 > ... >>> - u8 prescaler = 0; >>> + int prescaler = 1; >> >> Ugh, why do you move to signed arithmetics? > > Any arithmetic would always have been signed. > u8 is promoted to 'signed int' before being used for pretty much anything. Sorry, what? C99 ยง6.3.8.1 states: If both operands have the same type, then no further conversion is needed. Otherwise, if both operands have signed integer types or both have unsigned integer types, the operand with the type of lesser integer conversion rank is converted to the type of the operand with greater rank. ===== I.e. u8 is converted according to that to ulong in this case. So unsigned arithmetic happens. > 'unsigned int prescaler' might have changed arithmetic to be unsigned. The same as u8. > OTOH you probably don't want a u8 - that might require the compiler > mask an arithmetic result to 8 bits. Pardon? Not at all. Am I missing something? thanks, -- js suse labs