Received: by 2002:a05:6a10:206:0:0:0:0 with SMTP id 6csp1935738pxj; Wed, 19 May 2021 18:13:23 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzeCtcWmChDvVYOK1dYfiG15shipZQHxXkWcBjdFEQ2zd5zWaTMSMfNAj9jA5xa//XuGu9g X-Received: by 2002:a17:906:a84e:: with SMTP id dx14mr2014373ejb.220.1621473202989; Wed, 19 May 2021 18:13:22 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1621473202; cv=none; d=google.com; s=arc-20160816; b=cjJnaabgcznbnrQIEkJc70qz4/WrgUyCEfdUokgAlooCjhnhLFaA+KuUnqpvOZ4jPc k2XI1FMP9hDhgtJwzNgrbRc0SIssqky40FAfw7GSJgLYfbmaGqmqzOMvFkA2UiNrm74s QqvmTJXO5bPz3FsSRdI3ADXGobs1U96RyYpbzY2W8QqBk4m4Q1LgmifY1mmpxI6x04qv sOD1WriJ1lMJyH+JpsC5p3uz9U29Ct2MVEootzBN+ENHWtkgIquXRN7eIBXlBOJTJSW9 JaJ4Jp9IDbVnlCrYSjwDWHVoCyvaYEvSl3y51666AmJRKbbgY0FYDeoDktrfcRLaAJDh iAkQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=RZIG+EM6uaRr+XUAlJqa/20a+V53ZRgGqq+rGOqK7Zg=; b=GzX6GLMcV8+QS+QQdUsbhDFUTOVc8gw1WAV28mVB+6OdB+LjEBf9pY/REJ98nNASDZ Ks4/R4XPwrU8Prtcb045SrnrQ0TP/OMzNVDSL8XrIPaD2YGfuf1acLpuGkylW3OVqj2o mhvxXuetNYyiLBNDv4IocKaCSI4KUtezAtXQpmTeEE4uqDaBBzEfPP2RCQeQNuihCbEq 1ZwdAg6VwfyLZ7PO+QNJd6r2U32S8gVxxqvtUVy4yoUuBwlOwu39PMFDYAhTTwtiWK2b BB1hTnCPrfBcfrsgAb330p2u99ZQ6RNTjt9S/exLSdrn6k65LgC1Fkq0Src2cyuyoHRa lLzQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@lunn.ch header.s=20171124 header.b=roctrtOB; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id w14si908483edd.111.2021.05.19.18.12.58; Wed, 19 May 2021 18:13:22 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@lunn.ch header.s=20171124 header.b=roctrtOB; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230123AbhETBN3 (ORCPT + 99 others); Wed, 19 May 2021 21:13:29 -0400 Received: from vps0.lunn.ch ([185.16.172.187]:48364 "EHLO vps0.lunn.ch" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229498AbhETBN2 (ORCPT ); Wed, 19 May 2021 21:13:28 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lunn.ch; s=20171124; h=In-Reply-To:Content-Disposition:Content-Type:MIME-Version: References:Message-ID:Subject:Cc:To:From:Date:From:Sender:Reply-To:Subject: Date:Message-ID:To:Cc:MIME-Version:Content-Type:Content-Transfer-Encoding: Content-ID:Content-Description:Content-Disposition:In-Reply-To:References; bh=RZIG+EM6uaRr+XUAlJqa/20a+V53ZRgGqq+rGOqK7Zg=; b=roctrtOBVOdkvin79RwbjUqOTs ve6RfqR6Q7KoG8DUkFkpxqb5+IyEjAxUTUe0bDTsTVGXgnksUPV0Ebn1yQBiwf6Ajv0QIYCm2hPqv I9tFW2aYHVsbI36wOymVyhxTSOIWmcsoNVxCSzkkMGmsxLo+oeHD8SO1QJ3Ke8j54zdQ=; Received: from andrew by vps0.lunn.ch with local (Exim 4.94.2) (envelope-from ) id 1ljXEI-0050ih-I7; Thu, 20 May 2021 03:12:02 +0200 Date: Thu, 20 May 2021 03:12:02 +0200 From: Andrew Lunn To: Vadym Kochan Cc: "David S. Miller" , Jakub Kicinski , netdev@vger.kernel.org, Taras Chornyi , linux-kernel@vger.kernel.org, Mickey Rachamim , Vadym Kochan Subject: Re: [RFC net-next 1/4] net: marvell: prestera: try to load previous fw version Message-ID: References: <20210519143321.849-1-vadym.kochan@plvision.eu> <20210519143321.849-2-vadym.kochan@plvision.eu> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20210519143321.849-2-vadym.kochan@plvision.eu> Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org > +static int prestera_fw_get(struct prestera_fw *fw) > +{ > + int ver_maj = PRESTERA_SUPP_FW_MAJ_VER; > + int ver_min = PRESTERA_SUPP_FW_MIN_VER; > + char fw_path[128]; > + int err; > + > +pick_fw_ver: > + snprintf(fw_path, sizeof(fw_path), PRESTERA_FW_PATH_FMT, > + ver_maj, ver_min); > + > + err = request_firmware_direct(&fw->bin, fw_path, fw->dev.dev); > + if (err) { > + if (ver_maj == PRESTERA_SUPP_FW_MAJ_VER) { > + ver_maj--; > + goto pick_fw_ver; > + } else { > + dev_err(fw->dev.dev, "failed to request firmware file\n"); > + return err; > + } > + } So lets say for the sake of the argument, you have version 3.0 and 2.42. It looks like this code will first try to load version 3.0. If that fails, ver_maj is decremented, so it tries 2.0, which also fails because it should be looking for 2.42. I don't think this decrement is a good idea. Also: > + dev_err(fw->dev.dev, "failed to request firmware file\n"); It would be useful to say what version you are actually looking for, so the user can go find the correct firmware. Andrew