[{"id":3679428,"web_url":"http://patchwork.ozlabs.org/comment/3679428/","msgid":"<5584ba17-bc68-4d3a-aa63-0e18c3eff22a@omp.ru>","list_archive_url":null,"date":"2026-04-20T13:10:54","subject":"Re: [PATCH 5.10.y] ata: pata_sil680: fix result type of\n sil680_sel{dev|reg}()","submitter":{"id":81725,"url":"http://patchwork.ozlabs.org/api/people/81725/","name":"Sergey Shtylyov","email":"s.shtylyov@omp.ru"},"content":"On 4/20/26 1:23 AM, Rand Deeb wrote:\n\n> From: Sergey Shtylyov <s.shtylyov@omp.ru>\n> \n> [ Upstream commit dafbbf5c57dd6ae01d20b894bc2200e9d9834c4e ]\n> \n> sil680_sel{dev|reg}() return a PCI config space address but needlessly\n> use the *unsigned long* type for that,  whereas the PCI config space\n> accessors take *int* for the address parameter.  Switch these functions\n> to returning *int*, updating the local variables at their call sites.\n> Get rid of the 'base' local variables in these functions, while at it...\n> \n> Found by Linux Verification Center (linuxtesting.org) with the SVACE static\n> analysis tool.\n> \n> Signed-off-by: Sergey Shtylyov <s.shtylyov@omp.ru>\n> Signed-off-by: Damien Le Moal <damien.lemoal@opensource.wdc.com>\n> Signed-off-by: Rand Deeb <rand.sec96@gmail.com>\n> ---\n>  drivers/ata/pata_sil680.c | 30 +++++++++++++-----------------\n>  1 file changed, 13 insertions(+), 17 deletions(-)\n> \n> diff --git a/drivers/ata/pata_sil680.c b/drivers/ata/pata_sil680.c\n> index 7ab9aea3b..fe60f884b 100644\n> --- a/drivers/ata/pata_sil680.c\n> +++ b/drivers/ata/pata_sil680.c\n> @@ -47,11 +47,9 @@\n>   *     criticial.\n>   */\n> \n> -static unsigned long sil680_selreg(struct ata_port *ap, int r)\n> +static int sil680_selreg(struct ata_port *ap, int r)\n>  {\n> -       unsigned long base = 0xA0 + r;\n> -       base += (ap->port_no << 4);\n> -       return base;\n> +       return 0xA0 + (ap->port_no << 4) + r;\n>  }\n> \n>  /**\n> @@ -64,12 +62,9 @@ static unsigned long sil680_selreg(struct ata_port *ap, int r)\n>   *     the unit shift.\n>   */\n> \n> -static unsigned long sil680_seldev(struct ata_port *ap, struct ata_device *adev, int r)\n> +static int sil680_seldev(struct ata_port *ap, struct ata_device *adev, int r)\n>  {\n> -       unsigned long base = 0xA0 + r;\n> -       base += (ap->port_no << 4);\n> -       base |= adev->devno ? 2 : 0;\n> -       return base;\n> +       return 0xA0 + (ap->port_no << 4) + r + (adev->devno << 1);\n>  }\n\n   And why exactly is this needed in 5.10.y?\n\n[...]\nMBR, Sergey","headers":{"Return-Path":"\n <linux-ide+bounces-5501-incoming=patchwork.ozlabs.org@vger.kernel.org>","X-Original-To":["incoming@patchwork.ozlabs.org","linux-ide@vger.kernel.org"],"Delivered-To":"patchwork-incoming@legolas.ozlabs.org","Authentication-Results":["legolas.ozlabs.org;\n spf=pass (sender SPF authorized) smtp.mailfrom=vger.kernel.org\n (client-ip=2600:3c04:e001:36c::12fc:5321; helo=tor.lore.kernel.org;\n envelope-from=linux-ide+bounces-5501-incoming=patchwork.ozlabs.org@vger.kernel.org;\n receiver=patchwork.ozlabs.org)","smtp.subspace.kernel.org;\n arc=none smtp.client-ip=90.154.21.10","smtp.subspace.kernel.org;\n dmarc=none (p=none dis=none) header.from=omp.ru","smtp.subspace.kernel.org;\n spf=pass smtp.mailfrom=omp.ru"],"Received":["from tor.lore.kernel.org (tor.lore.kernel.org\n [IPv6:2600:3c04:e001:36c::12fc:5321])\n\t(using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)\n\t key-exchange x25519 server-signature ECDSA (secp384r1) server-digest SHA384)\n\t(No client certificate requested)\n\tby legolas.ozlabs.org (Postfix) with ESMTPS id 4fzp206F7kz1yGs\n\tfor <incoming@patchwork.ozlabs.org>; Tue, 21 Apr 2026 00:35:52 +1000 (AEST)","from smtp.subspace.kernel.org (conduit.subspace.kernel.org\n [100.90.174.1])\n\tby tor.lore.kernel.org (Postfix) with ESMTP id 15C3330A37B6\n\tfor <incoming@patchwork.ozlabs.org>; Mon, 20 Apr 2026 13:56:13 +0000 (UTC)","from localhost.localdomain (localhost.localdomain [127.0.0.1])\n\tby smtp.subspace.kernel.org (Postfix) with ESMTP id 8A6AF3FB06B;\n\tMon, 20 Apr 2026 13:26:20 +0000 (UTC)","from mx01.omp.ru (mx01.omp.ru [90.154.21.10])\n\t(using TLSv1.2 with cipher ECDHE-RSA-AES256-SHA384 (256/256 bits))\n\t(No client certificate requested)\n\tby smtp.subspace.kernel.org (Postfix) with ESMTPS id AFB053BF676;\n\tMon, 20 Apr 2026 13:26:12 +0000 (UTC)","from [192.168.2.104] (213.87.137.185) by msexch01.omp.ru\n (10.188.4.12) with Microsoft SMTP Server (version=TLS1_2,\n cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384) id 15.2.1258.12; Mon, 20 Apr\n 2026 16:10:55 +0300"],"ARC-Seal":"i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116;\n\tt=1776691580; cv=none;\n b=pkEP92XNy9TQs9Yf4oO6LF8ih9IK7xiIM8rpOXMpffOjuFSy9XVtYIh3CJVGe/QqixUwJrEd0YHuHEpL88Q0MrPPCCo1U0nPafDr22yxxPWJyK62FmTVwLIDlAGOqBE5kn5MZp4yY9Y3WAR0SAp6Uk14E0yX7cppcd+thZkafIw=","ARC-Message-Signature":"i=1; a=rsa-sha256; d=subspace.kernel.org;\n\ts=arc-20240116; t=1776691580; c=relaxed/simple;\n\tbh=DNKwBGIaLjPlsb7ZI58Ka3QcN1r97FnA/wx1odcoGUs=;\n\th=Message-ID:Date:MIME-Version:Subject:To:CC:References:From:\n\t In-Reply-To:Content-Type;\n b=U1fA4VeDG1O+KJU5DI27SC0t8G7UNZyU7aqGOtVd3G9IZg1DSBJjGU6m3JniUXRo2jDdmxVVP1XeqzE42WyCo4cThMGTbXPj5SpTMeD3MYCAi0N8ta1YMpinm6J8GJGkSv551cRWddSWPWecPRbMyG5q3DPzcio0OuxeEPA01Fs=","ARC-Authentication-Results":"i=1; smtp.subspace.kernel.org;\n dmarc=none (p=none dis=none) header.from=omp.ru;\n spf=pass smtp.mailfrom=omp.ru; arc=none smtp.client-ip=90.154.21.10","Message-ID":"<5584ba17-bc68-4d3a-aa63-0e18c3eff22a@omp.ru>","Date":"Mon, 20 Apr 2026 16:10:54 +0300","Precedence":"bulk","X-Mailing-List":"linux-ide@vger.kernel.org","List-Id":"<linux-ide.vger.kernel.org>","List-Subscribe":"<mailto:linux-ide+subscribe@vger.kernel.org>","List-Unsubscribe":"<mailto:linux-ide+unsubscribe@vger.kernel.org>","MIME-Version":"1.0","User-Agent":"Mozilla Thunderbird","Subject":"Re: [PATCH 5.10.y] ata: pata_sil680: fix result type of\n sil680_sel{dev|reg}()","To":"Rand Deeb <rand.sec96@gmail.com>, <stable@vger.kernel.org>","CC":"<axboe@kernel.dk>, <linux-ide@vger.kernel.org>,\n\t<linux-kernel@vger.kernel.org>, <deeb.rand@confident.ru>,\n\t<lvc-project@linuxtesting.org>, <khoroshilov@ispras.ru>, Damien Le Moal\n\t<damien.lemoal@opensource.wdc.com>","References":"<20260419222355.5842-1-rand.sec96@gmail.com>","Content-Language":"en-US","From":"Sergey Shtylyov <s.shtylyov@omp.ru>","Organization":"Open Mobile Platform","In-Reply-To":"<20260419222355.5842-1-rand.sec96@gmail.com>","Content-Type":"text/plain; charset=\"UTF-8\"","Content-Transfer-Encoding":"7bit","X-ClientProxiedBy":"msexch01.omp.ru (10.188.4.12) To msexch01.omp.ru\n (10.188.4.12)","X-KSE-ServerInfo":"msexch01.omp.ru, 9","X-KSE-AntiSpam-Interceptor-Info":"scan successful","X-KSE-AntiSpam-Version":"6.1.1, Database issued on: 04/20/2026 13:02:31","X-KSE-AntiSpam-Status":"KAS_STATUS_NOT_DETECTED","X-KSE-AntiSpam-Method":"none","X-KSE-AntiSpam-Rate":"19","X-KSE-AntiSpam-Info":["Lua profiles 202452 [Apr 20 2026]","Version: 6.1.1.22","Envelope from: s.shtylyov@omp.ru","LuaCore: 100 0.3.100\n 82998f6d011048b8a55d77ec41a5097a5546c4f1","{rep_avail}","{Tracking_from_domain_doesnt_match_to}","{SMTP from is not routable}","{Found in DNSBL: 213.87.137.185 in (user)\n b.barracudacentral.org}","{Found in DNSBL: 213.87.137.185 in (user)\n dbl.spamhaus.org}","\n\tomp.ru:7.1.1;127.0.0.199:7.1.2;d41d8cd98f00b204e9800998ecf8427e.com:7.1.1","{Tracking_ip_hunter}","FromAlignment: s","ApMailHostAddress: 213.87.137.185","{DNS response errors}","Rate: 19","Status: not_detected","Method: none","Auth:dmarc=temperror header.from=omp.ru;spf=temperror\n smtp.mailfrom=omp.ru;dkim=none"],"X-KSE-Antiphishing-Info":"Clean","X-KSE-Antiphishing-ScanningType":"Heuristic","X-KSE-Antiphishing-Method":"None","X-KSE-Antiphishing-Bases":"04/20/2026 13:04:00","X-KSE-Antivirus-Interceptor-Info":"scan successful","X-KSE-Antivirus-Info":"Clean, bases: 4/20/2026 11:11:00 AM","X-KSE-Attachment-Filter-Triggered-Rules":"Clean","X-KSE-Attachment-Filter-Triggered-Filters":"Clean","X-KSE-BulkMessagesFiltering-Scan-Result":"InTheLimit"}}]