···199199 "qcom,kpss-acc-v1"200200 "qcom,kpss-acc-v2"201201 "rockchip,rk3066-smp"202202+ "ste,dbx500-smp"202203203204 - cpu-release-addr204205 Usage: required for systems that have an "enable-method"
+9
MAINTAINERS
···35883588F: drivers/gpu/drm/rockchip/35893589F: Documentation/devicetree/bindings/video/rockchip*3590359035913591+DRM DRIVERS FOR STI35923592+M: Benjamin Gaignard <benjamin.gaignard@linaro.org>35933593+M: Vincent Abriou <vincent.abriou@st.com>35943594+L: dri-devel@lists.freedesktop.org35953595+T: git http://git.linaro.org/people/benjamin.gaignard/kernel.git35963596+S: Maintained35973597+F: drivers/gpu/drm/sti35983598+F: Documentation/devicetree/bindings/gpu/st,stih4xx.txt35993599+35913600DSBR100 USB FM RADIO DRIVER35923601M: Alexey Klimov <klimov.linux@gmail.com>35933602L: linux-media@vger.kernel.org
···6161 movlt scno, #(__NR_restart_syscall - __NR_SYSCALL_BASE)6262 ldmia sp, {r0 - r6} @ have to reload r0 - r66363 b local_restart @ ... and off we go6464+ENDPROC(ret_fast_syscall)64656566/*6667 * "slow" syscall return path. "why" tells us if this was a real syscall.
+3
arch/arm/kernel/head.S
···399399 sub lr, r4, r5 @ mmu has been enabled400400 add r3, r7, lr401401 ldrd r4, [r3, #0] @ get secondary_data.pgdir402402+ARM_BE8(eor r4, r4, r5) @ Swap r5 and r4 in BE:403403+ARM_BE8(eor r5, r4, r5) @ it can be done in 3 steps404404+ARM_BE8(eor r4, r4, r5) @ without using a temp reg.402405 ldr r8, [r3, #8] @ get secondary_data.swapper_pg_dir403406 badr lr, __enable_mmu @ return address404407 mov r13, r12 @ __secondary_switched address
···12551255 cpumask_set_cpu(cpu, &cqm_cpumask);12561256}1257125712581258-static void intel_cqm_cpu_prepare(unsigned int cpu)12581258+static void intel_cqm_cpu_starting(unsigned int cpu)12591259{12601260 struct intel_pqr_state *state = &per_cpu(pqr_state, cpu);12611261 struct cpuinfo_x86 *c = &cpu_data(cpu);···12961296 unsigned int cpu = (unsigned long)hcpu;1297129712981298 switch (action & ~CPU_TASKS_FROZEN) {12991299- case CPU_UP_PREPARE:13001300- intel_cqm_cpu_prepare(cpu);13011301- break;13021299 case CPU_DOWN_PREPARE:13031300 intel_cqm_cpu_exit(cpu);13041301 break;13051302 case CPU_STARTING:13031303+ intel_cqm_cpu_starting(cpu);13061304 cqm_pick_event_reader(cpu);13071305 break;13081306 }···13711373 goto out;1372137413731375 for_each_online_cpu(i) {13741374- intel_cqm_cpu_prepare(i);13761376+ intel_cqm_cpu_starting(i);13751377 cqm_pick_event_reader(i);13761378 }13771379
+2-2
arch/x86/kernel/step.c
···2828 struct desc_struct *desc;2929 unsigned long base;30303131- seg &= ~7UL;3131+ seg >>= 3;32323333 mutex_lock(&child->mm->context.lock);3434 if (unlikely(!child->mm->context.ldt ||3535- (seg >> 3) >= child->mm->context.ldt->size))3535+ seg >= child->mm->context.ldt->size))3636 addr = -1L; /* bogus selector, access would fault */3737 else {3838 desc = &child->mm->context.ldt->entries[seg];
+6-1
arch/x86/kvm/x86.c
···21052105 if (guest_cpuid_has_tsc_adjust(vcpu)) {21062106 if (!msr_info->host_initiated) {21072107 s64 adj = data - vcpu->arch.ia32_tsc_adjust_msr;21082108- kvm_x86_ops->adjust_tsc_offset(vcpu, adj, true);21082108+ adjust_tsc_offset_guest(vcpu, adj);21092109 }21102110 vcpu->arch.ia32_tsc_adjust_msr = data;21112111 }···63276327static void process_smi(struct kvm_vcpu *vcpu)63286328{63296329 struct kvm_segment cs, ds;63306330+ struct desc_ptr dt;63306331 char buf[512];63316332 u32 cr0;63326333···63596358 vcpu->arch.cr0 = cr0;6360635963616360 kvm_x86_ops->set_cr4(vcpu, 0);63616361+63626362+ /* Undocumented: IDT limit is set to zero on entry to SMM. */63636363+ dt.address = dt.size = 0;63646364+ kvm_x86_ops->set_idt(vcpu, &dt);6362636563636366 __kvm_set_dr(vcpu, 7, DR7_FIXED_1);63646367
+1-2
arch/x86/math-emu/fpu_entry.c
···29293030#include <asm/uaccess.h>3131#include <asm/traps.h>3232-#include <asm/desc.h>3332#include <asm/user.h>3433#include <asm/fpu/internal.h>3534···180181 math_abort(FPU_info, SIGILL);181182 }182183183183- code_descriptor = LDT_DESCRIPTOR(FPU_CS);184184+ code_descriptor = FPU_get_ldt_descriptor(FPU_CS);184185 if (SEG_D_SIZE(code_descriptor)) {185186 /* The above test may be wrong, the book is not clear */186187 /* Segmented 32 bit protected mode */
+18-3
arch/x86/math-emu/fpu_system.h
···1616#include <linux/kernel.h>1717#include <linux/mm.h>18181919-/* s is always from a cpu register, and the cpu does bounds checking2020- * during register load --> no further bounds checks needed */2121-#define LDT_DESCRIPTOR(s) (((struct desc_struct *)current->mm->context.ldt)[(s) >> 3])1919+#include <asm/desc.h>2020+#include <asm/mmu_context.h>2121+2222+static inline struct desc_struct FPU_get_ldt_descriptor(unsigned seg)2323+{2424+ static struct desc_struct zero_desc;2525+ struct desc_struct ret = zero_desc;2626+2727+#ifdef CONFIG_MODIFY_LDT_SYSCALL2828+ seg >>= 3;2929+ mutex_lock(¤t->mm->context.lock);3030+ if (current->mm->context.ldt && seg < current->mm->context.ldt->size)3131+ ret = current->mm->context.ldt->entries[seg];3232+ mutex_unlock(¤t->mm->context.lock);3333+#endif3434+ return ret;3535+}3636+2237#define SEG_D_SIZE(x) ((x).b & (3 << 21))2338#define SEG_G_BIT(x) ((x).b & (1 << 23))2439#define SEG_GRANULARITY(x) (((x).b & (1 << 23)) ? 4096 : 1)
···88 select PARAVIRT_CLOCK99 select XEN_HAVE_PVMMU1010 depends on X86_64 || (X86_32 && X86_PAE)1111- depends on X86_TSC1111+ depends on X86_LOCAL_APIC && X86_TSC1212 help1313 This is the Linux Xen port. Enabling this will allow the1414 kernel to boot in a paravirtualized environment under the···1717config XEN_DOM01818 def_bool y1919 depends on XEN && PCI_XEN && SWIOTLB_XEN2020- depends on X86_LOCAL_APIC && X86_IO_APIC && ACPI && PCI2020+ depends on X86_IO_APIC && ACPI && PCI21212222config XEN_PVHVM2323 def_bool y
+2-2
block/blk-settings.c
···241241 * Description:242242 * Enables a low level driver to set a hard upper limit,243243 * max_hw_sectors, on the size of requests. max_hw_sectors is set by244244- * the device driver based upon the combined capabilities of I/O245245- * controller and storage device.244244+ * the device driver based upon the capabilities of the I/O245245+ * controller.246246 *247247 * max_sectors is a soft limit imposed by the block layer for248248 * filesystem type requests. This value can be overridden on a
···10641064{10651065 struct hdmi_context *hdata = ctx_from_connector(connector);10661066 struct edid *edid;10671067+ int ret;1067106810681069 if (!hdata->ddc_adpt)10691070 return -ENODEV;···1080107910811080 drm_mode_connector_update_edid_property(connector, edid);1082108110831083- return drm_add_edid_modes(connector, edid);10821082+ ret = drm_add_edid_modes(connector, edid);10831083+10841084+ kfree(edid);10851085+10861086+ return ret;10841087}1085108810861089static int hdmi_find_phy_conf(struct hdmi_context *hdata, u32 pixel_clock)
+14-7
drivers/gpu/drm/exynos/exynos_mixer.c
···718718719719 /* handling VSYNC */720720 if (val & MXR_INT_STATUS_VSYNC) {721721+ /* vsync interrupt use different bit for read and clear */722722+ val |= MXR_INT_CLEAR_VSYNC;723723+ val &= ~MXR_INT_STATUS_VSYNC;724724+721725 /* interlace scan need to check shadow register */722726 if (ctx->interlace) {723727 base = mixer_reg_read(res, MXR_GRAPHIC_BASE(0));···747743748744out:749745 /* clear interrupts */750750- if (~val & MXR_INT_EN_VSYNC) {751751- /* vsync interrupt use different bit for read and clear */752752- val &= ~MXR_INT_EN_VSYNC;753753- val |= MXR_INT_CLEAR_VSYNC;754754- }755746 mixer_reg_write(res, MXR_INT_STATUS, val);756747757748 spin_unlock(&res->reg_slock);···906907 }907908908909 /* enable vsync interrupt */909909- mixer_reg_writemask(res, MXR_INT_EN, MXR_INT_EN_VSYNC,910910- MXR_INT_EN_VSYNC);910910+ mixer_reg_writemask(res, MXR_INT_STATUS, ~0, MXR_INT_CLEAR_VSYNC);911911+ mixer_reg_writemask(res, MXR_INT_EN, ~0, MXR_INT_EN_VSYNC);911912912913 return 0;913914}···917918 struct mixer_context *mixer_ctx = crtc->ctx;918919 struct mixer_resources *res = &mixer_ctx->mixer_res;919920921921+ if (!mixer_ctx->powered) {922922+ mixer_ctx->int_en &= MXR_INT_EN_VSYNC;923923+ return;924924+ }925925+920926 /* disable vsync interrupt */927927+ mixer_reg_writemask(res, MXR_INT_STATUS, ~0, MXR_INT_CLEAR_VSYNC);921928 mixer_reg_writemask(res, MXR_INT_EN, 0, MXR_INT_EN_VSYNC);922929}923930···1052104710531048 mixer_reg_writemask(res, MXR_STATUS, ~0, MXR_STATUS_SOFT_RESET);1054104910501050+ if (ctx->int_en & MXR_INT_EN_VSYNC)10511051+ mixer_reg_writemask(res, MXR_INT_STATUS, ~0, MXR_INT_CLEAR_VSYNC);10551052 mixer_reg_write(res, MXR_INT_EN, ctx->int_en);10561053 mixer_win_reset(ctx);10571054}
+8-37
drivers/gpu/drm/i915/intel_atomic.c
···129129 struct drm_atomic_state *state,130130 bool async)131131{132132- int ret;133133- int i;132132+ struct drm_crtc_state *crtc_state;133133+ struct drm_crtc *crtc;134134+ int ret, i;134135135136 if (async) {136137 DRM_DEBUG_KMS("i915 does not yet support async commit\n");···143142 return ret;144143145144 /* Point of no return */146146-147147- /*148148- * FIXME: The proper sequence here will eventually be:149149- *150150- * drm_atomic_helper_swap_state(dev, state)151151- * drm_atomic_helper_commit_modeset_disables(dev, state);152152- * drm_atomic_helper_commit_planes(dev, state);153153- * drm_atomic_helper_commit_modeset_enables(dev, state);154154- * drm_atomic_helper_wait_for_vblanks(dev, state);155155- * drm_atomic_helper_cleanup_planes(dev, state);156156- * drm_atomic_state_free(state);157157- *158158- * once we have full atomic modeset. For now, just manually update159159- * plane states to avoid clobbering good states with dummy states160160- * while nuclear pageflipping.161161- */162162- for (i = 0; i < dev->mode_config.num_total_plane; i++) {163163- struct drm_plane *plane = state->planes[i];164164-165165- if (!plane)166166- continue;167167-168168- plane->state->state = state;169169- swap(state->plane_states[i], plane->state);170170- plane->state->state = NULL;171171- }145145+ drm_atomic_helper_swap_state(dev, state);172146173147 /* swap crtc_scaler_state */174174- for (i = 0; i < dev->mode_config.num_crtc; i++) {175175- struct drm_crtc *crtc = state->crtcs[i];176176- if (!crtc) {177177- continue;178178- }179179-180180- to_intel_crtc(crtc)->config->scaler_state =181181- to_intel_crtc_state(state->crtc_states[i])->scaler_state;148148+ for_each_crtc_in_state(state, crtc, crtc_state, i) {149149+ to_intel_crtc(crtc)->config = to_intel_crtc_state(crtc->state);182150183151 if (INTEL_INFO(dev)->gen >= 9)184152 skl_detach_scalers(to_intel_crtc(crtc));153153+154154+ drm_atomic_helper_commit_planes_on_crtc(crtc_state);185155 }186156187187- drm_atomic_helper_commit_planes(dev, state);188157 drm_atomic_helper_wait_for_vblanks(dev, state);189158 drm_atomic_helper_cleanup_planes(dev, state);190159 drm_atomic_state_free(state);
+15-44
drivers/gpu/drm/i915/intel_display.c
···1182611826 goto encoder_retry;1182711827 }11828118281182911829- pipe_config->dither = pipe_config->pipe_bpp != base_bpp;1182911829+ /* Dithering seems to not pass-through bits correctly when it should, so1183011830+ * only enable it on 6bpc panels. */1183111831+ pipe_config->dither = pipe_config->pipe_bpp == 6*3;1183011832 DRM_DEBUG_KMS("plane bpp: %i, pipe bpp: %i, dithering: %i\n",1183111833 base_bpp, pipe_config->pipe_bpp, pipe_config->dither);1183211834···12626126241262712625 modeset_update_crtc_power_domains(state);12628126261262912629- drm_atomic_helper_commit_planes(dev, state);1263012630-1263112627 /* Now enable the clocks, plane, pipe, and connectors that we set up. */1263212628 for_each_crtc_in_state(state, crtc, crtc_state, i) {1263312633- if (!needs_modeset(crtc->state) || !crtc->state->enable)1262912629+ if (!needs_modeset(crtc->state) || !crtc->state->enable) {1263012630+ drm_atomic_helper_commit_planes_on_crtc(crtc_state);1263412631 continue;1263212632+ }12635126331263612634 update_scanline_offset(to_intel_crtc(crtc));12637126351263812636 dev_priv->display.crtc_enable(crtc);1263912639- intel_crtc_enable_planes(crtc);1263712637+ drm_atomic_helper_commit_planes_on_crtc(crtc_state);1264012638 }12641126391264212640 /* FIXME: add subpixel order */···1289312891 return 0;1289412892}12895128931289612896-static bool primary_plane_visible(struct drm_crtc *crtc)1289712897-{1289812898- struct intel_plane_state *plane_state =1289912899- to_intel_plane_state(crtc->primary->state);1290012900-1290112901- return plane_state->visible;1290212902-}1290312903-1290412894static int intel_crtc_set_config(struct drm_mode_set *set)1290512895{1290612896 struct drm_device *dev;1290712897 struct drm_atomic_state *state = NULL;1290812898 struct intel_crtc_state *pipe_config;1290912909- bool primary_plane_was_visible;1291012899 int ret;12911129001291212901 BUG_ON(!set);···12936129431293712944 intel_update_pipe_size(to_intel_crtc(set->crtc));12938129451293912939- primary_plane_was_visible = primary_plane_visible(set->crtc);1294012940-1294112946 ret = intel_set_mode_with_config(set->crtc, pipe_config, true);1294212942-1294312943- if (ret == 0 &&1294412944- pipe_config->base.enable &&1294512945- pipe_config->base.planes_changed &&1294612946- !needs_modeset(&pipe_config->base)) {1294712947- struct intel_crtc *intel_crtc = to_intel_crtc(set->crtc);1294812948-1294912949- /*1295012950- * We need to make sure the primary plane is re-enabled if it1295112951- * has previously been turned off.1295212952- */1295312953- if (ret == 0 && !primary_plane_was_visible &&1295412954- primary_plane_visible(set->crtc)) {1295512955- WARN_ON(!intel_crtc->active);1295612956- intel_post_enable_primary(set->crtc);1295712957- }1295812958-1295912959- /*1296012960- * In the fastboot case this may be our only check of the1296112961- * state after boot. It would be better to only do it on1296212962- * the first update, but we don't have a nice way of doing that1296312963- * (and really, set_config isn't used much for high freq page1296412964- * flipping, so increasing its cost here shouldn't be a big1296512965- * deal).1296612966- */1296712967- if (i915.fastboot && ret == 0)1296812968- intel_modeset_check_state(set->crtc->dev);1296912969- }12970129471297112948 if (ret) {1297212949 DRM_DEBUG_KMS("failed to set mode on [CRTC:%d], err = %d\n",···1326813305 */1326913306 if (IS_BROADWELL(dev))1327013307 intel_crtc->atomic.wait_vblank = true;1330813308+1330913309+ if (crtc_state)1331013310+ intel_crtc->atomic.post_enable_primary = true;1327113311 }13272133121327313313 /*···1328213316 */1328313317 if (!state->visible || !fb)1328413318 intel_crtc->atomic.disable_ips = true;1331913319+1332013320+ if (!state->visible && old_state->visible &&1332113321+ crtc_state && !needs_modeset(&crtc_state->base))1332213322+ intel_crtc->atomic.pre_disable_primary = true;13285133231328613324 intel_crtc->atomic.fb_bits |=1328713325 INTEL_FRONTBUFFER_PRIMARY(intel_crtc->pipe);···1500415034 struct intel_plane_state *plane_state;15005150351500615036 memset(crtc->config, 0, sizeof(*crtc->config));1503715037+ crtc->config->base.crtc = &crtc->base;15007150381500815039 crtc->config->quirks |= PIPE_CONFIG_QUIRK_INHERITED_MODE;1500915040
···24922492 ret = ttm_eu_reserve_buffers(&ticket, &sw_context->validate_nodes,24932493 true, NULL);24942494 if (unlikely(ret != 0))24952495- goto out_err;24952495+ goto out_err_nores;2496249624972497 ret = vmw_validate_buffers(dev_priv, sw_context);24982498 if (unlikely(ret != 0))···25362536 vmw_resource_relocations_free(&sw_context->res_relocations);2537253725382538 vmw_fifo_commit(dev_priv, command_size);25392539+ mutex_unlock(&dev_priv->binding_mutex);2539254025402541 vmw_query_bo_switch_commit(dev_priv, sw_context);25412542 ret = vmw_execbuf_fence_commands(file_priv, dev_priv,···25522551 DRM_ERROR("Fence submission error. Syncing.\n");2553255225542553 vmw_resource_list_unreserve(&sw_context->resource_list, false);25552555- mutex_unlock(&dev_priv->binding_mutex);2556255425572555 ttm_eu_fence_buffer_objects(&ticket, &sw_context->validate_nodes,25582556 (void *) fence);
+1-1
drivers/infiniband/hw/cxgb4/cq.c
···814814 printk(KERN_ERR MOD815815 "Unexpected cqe_status 0x%x for QPID=0x%0x\n",816816 CQE_STATUS(&cqe), CQE_QPID(&cqe));817817- ret = -EINVAL;817817+ wc->status = IB_WC_FATAL_ERR;818818 }819819 }820820out:
+6
drivers/memory/omap-gpmc.c
···22452245{22462246 int i;2247224722482248+ if (!gpmc_base)22492249+ return;22502250+22482251 gpmc_context.sysconfig = gpmc_read_reg(GPMC_SYSCONFIG);22492252 gpmc_context.irqenable = gpmc_read_reg(GPMC_IRQENABLE);22502253 gpmc_context.timeout_ctrl = gpmc_read_reg(GPMC_TIMEOUT_CONTROL);···22792276void omap3_gpmc_restore_context(void)22802277{22812278 int i;22792279+22802280+ if (!gpmc_base)22812281+ return;2282228222832283 gpmc_write_reg(GPMC_SYSCONFIG, gpmc_context.sysconfig);22842284 gpmc_write_reg(GPMC_IRQENABLE, gpmc_context.irqenable);
+2-2
drivers/net/ethernet/emulex/benet/be_main.c
···51735173 struct device *dev = &adapter->pdev->dev;51745174 int status;5175517551765176- if (lancer_chip(adapter) || BEx_chip(adapter))51765176+ if (lancer_chip(adapter) || BEx_chip(adapter) || be_is_mc(adapter))51775177 return;5178517851795179 if (adapter->flags & BE_FLAGS_VXLAN_OFFLOADS) {···52205220{52215221 struct be_adapter *adapter = netdev_priv(netdev);5222522252235223- if (lancer_chip(adapter) || BEx_chip(adapter))52235223+ if (lancer_chip(adapter) || BEx_chip(adapter) || be_is_mc(adapter))52245224 return;5225522552265226 if (adapter->vxlan_port != port)
+5
drivers/net/ethernet/freescale/gianfar.c
···20672067 /* Start Rx/Tx DMA and enable the interrupts */20682068 gfar_start(priv);2069206920702070+ /* force link state update after mac reset */20712071+ priv->oldlink = 0;20722072+ priv->oldspeed = 0;20732073+ priv->oldduplex = -1;20742074+20702075 phy_start(priv->phydev);2071207620722077 enable_napi(priv);
···814814 bool needs_aneg = false, do_suspend = false;815815 enum phy_state old_state;816816 int err = 0;817817+ int old_link;817818818819 mutex_lock(&phydev->lock);819820···900899 phydev->adjust_link(phydev->attached_dev);901900 break;902901 case PHY_RUNNING:903903- /* Only register a CHANGE if we are904904- * polling or ignoring interrupts902902+ /* Only register a CHANGE if we are polling or ignoring903903+ * interrupts and link changed since latest checking.905904 */906906- if (!phy_interrupt_is_valid(phydev))907907- phydev->state = PHY_CHANGELINK;905905+ if (!phy_interrupt_is_valid(phydev)) {906906+ old_link = phydev->link;907907+ err = phy_read_status(phydev);908908+ if (err)909909+ break;910910+911911+ if (old_link != phydev->link)912912+ phydev->state = PHY_CHANGELINK;913913+ }908914 break;909915 case PHY_CHANGELINK:910916 err = phy_read_status(phydev);
+19-12
drivers/net/phy/smsc.c
···9191}92929393/*9494- * The LAN8710/LAN8720 requires a minimum of 2 link pulses within 64ms of each9595- * other in order to set the ENERGYON bit and exit EDPD mode. If a link partner9696- * does send the pulses within this interval, the PHY will remained powered9797- * down.9898- *9999- * This workaround will manually toggle the PHY on/off upon calls to read_status100100- * in order to generate link test pulses if the link is down. If a link partner101101- * is present, it will respond to the pulses, which will cause the ENERGYON bit102102- * to be set and will cause the EDPD mode to be exited.9494+ * The LAN87xx suffers from rare absence of the ENERGYON-bit when Ethernet cable9595+ * plugs in while LAN87xx is in Energy Detect Power-Down mode. This leads to9696+ * unstable detection of plugging in Ethernet cable.9797+ * This workaround disables Energy Detect Power-Down mode and waiting for9898+ * response on link pulses to detect presence of plugged Ethernet cable.9999+ * The Energy Detect Power-Down mode is enabled again in the end of procedure to100100+ * save approximately 220 mW of power if cable is unplugged.103101 */104102static int lan87xx_read_status(struct phy_device *phydev)105103{106104 int err = genphy_read_status(phydev);105105+ int i;107106108107 if (!phydev->link) {109108 /* Disable EDPD to wake up PHY */···115116 if (rc < 0)116117 return rc;117118118118- /* Sleep 64 ms to allow ~5 link test pulses to be sent */119119- msleep(64);119119+ /* Wait max 640 ms to detect energy */120120+ for (i = 0; i < 64; i++) {121121+ /* Sleep to allow link test pulses to be sent */122122+ msleep(10);123123+ rc = phy_read(phydev, MII_LAN83C185_CTRL_STATUS);124124+ if (rc < 0)125125+ return rc;126126+ if (rc & MII_LAN83C185_ENERGYON)127127+ break;128128+ }120129121130 /* Re-enable EDPD */122131 rc = phy_read(phydev, MII_LAN83C185_CTRL_STATUS);···198191199192 /* basic functions */200193 .config_aneg = genphy_config_aneg,201201- .read_status = genphy_read_status,194194+ .read_status = lan87xx_read_status,202195 .config_init = smsc_phy_config_init,203196 .soft_reset = smsc_phy_reset,204197
+42-36
drivers/net/ppp/ppp_generic.c
···269269static void ppp_ccp_closed(struct ppp *ppp);270270static struct compressor *find_compressor(int type);271271static void ppp_get_stats(struct ppp *ppp, struct ppp_stats *st);272272-static struct ppp *ppp_create_interface(struct net *net, int unit, int *retp);272272+static struct ppp *ppp_create_interface(struct net *net, int unit,273273+ struct file *file, int *retp);273274static void init_ppp_file(struct ppp_file *pf, int kind);274274-static void ppp_shutdown_interface(struct ppp *ppp);275275static void ppp_destroy_interface(struct ppp *ppp);276276static struct ppp *ppp_find_unit(struct ppp_net *pn, int unit);277277static struct channel *ppp_find_channel(struct ppp_net *pn, int unit);···392392 file->private_data = NULL;393393 if (pf->kind == INTERFACE) {394394 ppp = PF_TO_PPP(pf);395395+ rtnl_lock();395396 if (file == ppp->owner)396396- ppp_shutdown_interface(ppp);397397+ unregister_netdevice(ppp->dev);398398+ rtnl_unlock();397399 }398400 if (atomic_dec_and_test(&pf->refcnt)) {399401 switch (pf->kind) {···595593 mutex_lock(&ppp_mutex);596594 if (pf->kind == INTERFACE) {597595 ppp = PF_TO_PPP(pf);596596+ rtnl_lock();598597 if (file == ppp->owner)599599- ppp_shutdown_interface(ppp);598598+ unregister_netdevice(ppp->dev);599599+ rtnl_unlock();600600 }601601 if (atomic_long_read(&file->f_count) < 2) {602602 ppp_release(NULL, file);···842838 /* Create a new ppp unit */843839 if (get_user(unit, p))844840 break;845845- ppp = ppp_create_interface(net, unit, &err);841841+ ppp = ppp_create_interface(net, unit, file, &err);846842 if (!ppp)847843 break;848844 file->private_data = &ppp->file;849849- ppp->owner = file;850845 err = -EFAULT;851846 if (put_user(ppp->file.index, p))852847 break;···919916static __net_exit void ppp_exit_net(struct net *net)920917{921918 struct ppp_net *pn = net_generic(net, ppp_net_id);919919+ struct ppp *ppp;920920+ LIST_HEAD(list);921921+ int id;922922+923923+ rtnl_lock();924924+ idr_for_each_entry(&pn->units_idr, ppp, id)925925+ unregister_netdevice_queue(ppp->dev, &list);926926+927927+ unregister_netdevice_many(&list);928928+ rtnl_unlock();922929923930 idr_destroy(&pn->units_idr);924931}···11011088 return 0;11021089}1103109010911091+static void ppp_dev_uninit(struct net_device *dev)10921092+{10931093+ struct ppp *ppp = netdev_priv(dev);10941094+ struct ppp_net *pn = ppp_pernet(ppp->ppp_net);10951095+10961096+ ppp_lock(ppp);10971097+ ppp->closing = 1;10981098+ ppp_unlock(ppp);10991099+11001100+ mutex_lock(&pn->all_ppp_mutex);11011101+ unit_put(&pn->units_idr, ppp->file.index);11021102+ mutex_unlock(&pn->all_ppp_mutex);11031103+11041104+ ppp->owner = NULL;11051105+11061106+ ppp->file.dead = 1;11071107+ wake_up_interruptible(&ppp->file.rwait);11081108+}11091109+11041110static const struct net_device_ops ppp_netdev_ops = {11051111 .ndo_init = ppp_dev_init,11121112+ .ndo_uninit = ppp_dev_uninit,11061113 .ndo_start_xmit = ppp_start_xmit,11071114 .ndo_do_ioctl = ppp_net_ioctl,11081115 .ndo_get_stats64 = ppp_get_stats64,···27002667 * or if there is already a unit with the requested number.27012668 * unit == -1 means allocate a new number.27022669 */27032703-static struct ppp *27042704-ppp_create_interface(struct net *net, int unit, int *retp)26702670+static struct ppp *ppp_create_interface(struct net *net, int unit,26712671+ struct file *file, int *retp)27052672{27062673 struct ppp *ppp;27072674 struct ppp_net *pn;···27212688 ppp->mru = PPP_MRU;27222689 init_ppp_file(&ppp->file, INTERFACE);27232690 ppp->file.hdrlen = PPP_HDRLEN - 2; /* don't count proto bytes */26912691+ ppp->owner = file;27242692 for (i = 0; i < NUM_NP; ++i)27252693 ppp->npmode[i] = NPMODE_PASS;27262694 INIT_LIST_HEAD(&ppp->channels);···28072773 skb_queue_head_init(&pf->rq);28082774 atomic_set(&pf->refcnt, 1);28092775 init_waitqueue_head(&pf->rwait);28102810-}28112811-28122812-/*28132813- * Take down a ppp interface unit - called when the owning file28142814- * (the one that created the unit) is closed or detached.28152815- */28162816-static void ppp_shutdown_interface(struct ppp *ppp)28172817-{28182818- struct ppp_net *pn;28192819-28202820- pn = ppp_pernet(ppp->ppp_net);28212821- mutex_lock(&pn->all_ppp_mutex);28222822-28232823- /* This will call dev_close() for us. */28242824- ppp_lock(ppp);28252825- if (!ppp->closing) {28262826- ppp->closing = 1;28272827- ppp_unlock(ppp);28282828- unregister_netdev(ppp->dev);28292829- unit_put(&pn->units_idr, ppp->file.index);28302830- } else28312831- ppp_unlock(ppp);28322832-28332833- ppp->file.dead = 1;28342834- ppp->owner = NULL;28352835- wake_up_interruptible(&ppp->file.rwait);28362836-28372837- mutex_unlock(&pn->all_ppp_mutex);28382776}2839277728402778/*
···733733 if (resp) {734734 resp(sp, fp, arg);735735 res = true;736736- } else if (!IS_ERR(fp)) {737737- fc_frame_free(fp);738736 }739737740738 spin_lock_bh(&ep->ex_lock);···15941596 * If new exch resp handler is valid then call that15951597 * first.15961598 */15971597- fc_invoke_resp(ep, sp, fp);15991599+ if (!fc_invoke_resp(ep, sp, fp))16001600+ fc_frame_free(fp);1598160115991602 fc_exch_release(ep);16001603 return;···16941695 fc_exch_hold(ep);16951696 if (!rc)16961697 fc_exch_delete(ep);16971697- fc_invoke_resp(ep, sp, fp);16981698+ if (!fc_invoke_resp(ep, sp, fp))16991699+ fc_frame_free(fp);16981700 if (has_rec)16991701 fc_exch_timer_set(ep, ep->r_a_tov);17001702 fc_exch_release(ep);
+17-2
drivers/scsi/libfc/fc_fcp.c
···10391039 fc_fcp_pkt_hold(fsp);10401040 spin_unlock_irqrestore(&si->scsi_queue_lock, flags);1041104110421042- if (!fc_fcp_lock_pkt(fsp)) {10421042+ spin_lock_bh(&fsp->scsi_pkt_lock);10431043+ if (!(fsp->state & FC_SRB_COMPL)) {10441044+ fsp->state |= FC_SRB_COMPL;10451045+ /*10461046+ * TODO: dropping scsi_pkt_lock and then reacquiring10471047+ * again around fc_fcp_cleanup_cmd() is required,10481048+ * since fc_fcp_cleanup_cmd() calls into10491049+ * fc_seq_set_resp() and that func preempts cpu using10501050+ * schedule. May be schedule and related code should be10511051+ * removed instead of unlocking here to avoid scheduling10521052+ * while atomic bug.10531053+ */10541054+ spin_unlock_bh(&fsp->scsi_pkt_lock);10551055+10431056 fc_fcp_cleanup_cmd(fsp, error);10571057+10581058+ spin_lock_bh(&fsp->scsi_pkt_lock);10441059 fc_io_compl(fsp);10451045- fc_fcp_unlock_pkt(fsp);10461060 }10611061+ spin_unlock_bh(&fsp->scsi_pkt_lock);1047106210481063 fc_fcp_pkt_release(fsp);10491064 spin_lock_irqsave(&si->scsi_queue_lock, flags);
+2-23
drivers/scsi/libiscsi.c
···29412941{29422942 struct iscsi_conn *conn = cls_conn->dd_data;29432943 struct iscsi_session *session = conn->session;29442944- unsigned long flags;2945294429462945 del_timer_sync(&conn->transport_timer);2947294629472947+ mutex_lock(&session->eh_mutex);29482948 spin_lock_bh(&session->frwd_lock);29492949 conn->c_stage = ISCSI_CONN_CLEANUP_WAIT;29502950 if (session->leadconn == conn) {···29552955 wake_up(&conn->ehwait);29562956 }29572957 spin_unlock_bh(&session->frwd_lock);29582958-29592959- /*29602960- * Block until all in-progress commands for this connection29612961- * time out or fail.29622962- */29632963- for (;;) {29642964- spin_lock_irqsave(session->host->host_lock, flags);29652965- if (!atomic_read(&session->host->host_busy)) { /* OK for ERL == 0 */29662966- spin_unlock_irqrestore(session->host->host_lock, flags);29672967- break;29682968- }29692969- spin_unlock_irqrestore(session->host->host_lock, flags);29702970- msleep_interruptible(500);29712971- iscsi_conn_printk(KERN_INFO, conn, "iscsi conn_destroy(): "29722972- "host_busy %d host_failed %d\n",29732973- atomic_read(&session->host->host_busy),29742974- session->host->host_failed);29752975- /*29762976- * force eh_abort() to unblock29772977- */29782978- wake_up(&conn->ehwait);29792979- }2980295829812959 /* flush queued up work because we free the connection below */29822960 iscsi_suspend_tx(conn);···29722994 if (session->leadconn == conn)29732995 session->leadconn = NULL;29742996 spin_unlock_bh(&session->frwd_lock);29972997+ mutex_unlock(&session->eh_mutex);2975299829762999 iscsi_destroy_conn(cls_conn);29773000}
-31
drivers/scsi/scsi_error.c
···2626#include <linux/blkdev.h>2727#include <linux/delay.h>2828#include <linux/jiffies.h>2929-#include <asm/unaligned.h>30293130#include <scsi/scsi.h>3231#include <scsi/scsi_cmnd.h>···25222523 }25232524}25242525EXPORT_SYMBOL(scsi_build_sense_buffer);25252525-25262526-/**25272527- * scsi_set_sense_information - set the information field in a25282528- * formatted sense data buffer25292529- * @buf: Where to build sense data25302530- * @info: 64-bit information value to be set25312531- *25322532- **/25332533-void scsi_set_sense_information(u8 *buf, u64 info)25342534-{25352535- if ((buf[0] & 0x7f) == 0x72) {25362536- u8 *ucp, len;25372537-25382538- len = buf[7];25392539- ucp = (char *)scsi_sense_desc_find(buf, len + 8, 0);25402540- if (!ucp) {25412541- buf[7] = len + 0xa;25422542- ucp = buf + 8 + len;25432543- }25442544- ucp[0] = 0;25452545- ucp[1] = 0xa;25462546- ucp[2] = 0x80; /* Valid bit */25472547- ucp[3] = 0;25482548- put_unaligned_be64(info, &ucp[4]);25492549- } else if ((buf[0] & 0x7f) == 0x70) {25502550- buf[0] |= 0x80;25512551- put_unaligned_be64(info, &buf[3]);25522552- }25532553-}25542554-EXPORT_SYMBOL(scsi_set_sense_information);
···457457 if (!strcmp(t->tf_ops->name, fo->name)) {458458 BUG_ON(atomic_read(&t->tf_access_cnt));459459 list_del(&t->tf_list);460460+ mutex_unlock(&g_tf_lock);461461+ /*462462+ * Wait for any outstanding fabric se_deve_entry->rcu_head463463+ * callbacks to complete post kfree_rcu(), before allowing464464+ * fabric driver unload of TFO->module to proceed.465465+ */466466+ rcu_barrier();460467 kfree(t);461461- break;468468+ return;462469 }463470 }464471 mutex_unlock(&g_tf_lock);
+9-1
drivers/target/target_core_hba.c
···8484 list_for_each_entry(tb, &backend_list, list) {8585 if (tb->ops == ops) {8686 list_del(&tb->list);8787+ mutex_unlock(&backend_mutex);8888+ /*8989+ * Wait for any outstanding backend driver ->rcu_head9090+ * callbacks to complete post TBO->free_device() ->9191+ * call_rcu(), before allowing backend driver module9292+ * unload of target_backend_ops->owner to proceed.9393+ */9494+ rcu_barrier();8795 kfree(tb);8888- break;9696+ return;8997 }9098 }9199 mutex_unlock(&backend_mutex);
+25-19
drivers/target/target_core_spc.c
···12031203 struct se_dev_entry *deve;12041204 struct se_session *sess = cmd->se_sess;12051205 struct se_node_acl *nacl;12061206+ struct scsi_lun slun;12061207 unsigned char *buf;12071208 u32 lun_count = 0, offset = 8;12081208-12091209- if (cmd->data_length < 16) {12101210- pr_warn("REPORT LUNS allocation length %u too small\n",12111211- cmd->data_length);12121212- return TCM_INVALID_CDB_FIELD;12131213- }12091209+ __be32 len;1214121012151211 buf = transport_kmap_data_sg(cmd);12161216- if (!buf)12121212+ if (cmd->data_length && !buf)12171213 return TCM_LOGICAL_UNIT_COMMUNICATION_FAILURE;1218121412191215 /*···12171221 * coming via a target_core_mod PASSTHROUGH op, and not through12181222 * a $FABRIC_MOD. In that case, report LUN=0 only.12191223 */12201220- if (!sess) {12211221- int_to_scsilun(0, (struct scsi_lun *)&buf[offset]);12221222- lun_count = 1;12241224+ if (!sess)12231225 goto done;12241224- }12261226+12251227 nacl = sess->se_node_acl;1226122812271229 rcu_read_lock();···12301236 * See SPC2-R20 7.19.12311237 */12321238 lun_count++;12331233- if ((offset + 8) > cmd->data_length)12391239+ if (offset >= cmd->data_length)12341240 continue;1235124112361236- int_to_scsilun(deve->mapped_lun, (struct scsi_lun *)&buf[offset]);12421242+ int_to_scsilun(deve->mapped_lun, &slun);12431243+ memcpy(buf + offset, &slun,12441244+ min(8u, cmd->data_length - offset));12371245 offset += 8;12381246 }12391247 rcu_read_unlock();···12441248 * See SPC3 r07, page 159.12451249 */12461250done:12471247- lun_count *= 8;12481248- buf[0] = ((lun_count >> 24) & 0xff);12491249- buf[1] = ((lun_count >> 16) & 0xff);12501250- buf[2] = ((lun_count >> 8) & 0xff);12511251- buf[3] = (lun_count & 0xff);12521252- transport_kunmap_data_sg(cmd);12511251+ /*12521252+ * If no LUNs are accessible, report virtual LUN 0.12531253+ */12541254+ if (lun_count == 0) {12551255+ int_to_scsilun(0, &slun);12561256+ if (cmd->data_length > 8)12571257+ memcpy(buf + offset, &slun,12581258+ min(8u, cmd->data_length - offset));12591259+ lun_count = 1;12601260+ }12611261+12621262+ if (buf) {12631263+ len = cpu_to_be32(lun_count * 8);12641264+ memcpy(buf, &len, min_t(int, sizeof len, cmd->data_length));12651265+ transport_kunmap_data_sg(cmd);12661266+ }1253126712541268 target_complete_cmd_with_length(cmd, GOOD, 8 + lun_count * 8);12551269 return 0;
+47-32
drivers/thermal/cpu_cooling.c
···6868 * registered cooling device.6969 * @cpufreq_state: integer value representing the current state of cpufreq7070 * cooling devices.7171- * @cpufreq_val: integer value representing the absolute value of the clipped7171+ * @clipped_freq: integer value representing the absolute value of the clipped7272 * frequency.7373 * @max_level: maximum cooling level. One less than total number of valid7474 * cpufreq frequencies.···9191 int id;9292 struct thermal_cooling_device *cool_dev;9393 unsigned int cpufreq_state;9494- unsigned int cpufreq_val;9494+ unsigned int clipped_freq;9595 unsigned int max_level;9696 unsigned int *freq_table; /* In descending order */9797 struct cpumask allowed_cpus;···107107static DEFINE_IDR(cpufreq_idr);108108static DEFINE_MUTEX(cooling_cpufreq_lock);109109110110+static unsigned int cpufreq_dev_count;111111+112112+static DEFINE_MUTEX(cooling_list_lock);110113static LIST_HEAD(cpufreq_dev_list);111114112115/**···188185{189186 struct cpufreq_cooling_device *cpufreq_dev;190187191191- mutex_lock(&cooling_cpufreq_lock);188188+ mutex_lock(&cooling_list_lock);192189 list_for_each_entry(cpufreq_dev, &cpufreq_dev_list, node) {193190 if (cpumask_test_cpu(cpu, &cpufreq_dev->allowed_cpus)) {194194- mutex_unlock(&cooling_cpufreq_lock);191191+ mutex_unlock(&cooling_list_lock);195192 return get_level(cpufreq_dev, freq);196193 }197194 }198198- mutex_unlock(&cooling_cpufreq_lock);195195+ mutex_unlock(&cooling_list_lock);199196200197 pr_err("%s: cpu:%d not part of any cooling device\n", __func__, cpu);201198 return THERMAL_CSTATE_INVALID;···218215 unsigned long event, void *data)219216{220217 struct cpufreq_policy *policy = data;221221- unsigned long max_freq = 0;218218+ unsigned long clipped_freq;222219 struct cpufreq_cooling_device *cpufreq_dev;223220224224- switch (event) {225225-226226- case CPUFREQ_ADJUST:227227- mutex_lock(&cooling_cpufreq_lock);228228- list_for_each_entry(cpufreq_dev, &cpufreq_dev_list, node) {229229- if (!cpumask_test_cpu(policy->cpu,230230- &cpufreq_dev->allowed_cpus))231231- continue;232232-233233- max_freq = cpufreq_dev->cpufreq_val;234234-235235- if (policy->max != max_freq)236236- cpufreq_verify_within_limits(policy, 0,237237- max_freq);238238- }239239- mutex_unlock(&cooling_cpufreq_lock);240240- break;241241- default:221221+ if (event != CPUFREQ_ADJUST)242222 return NOTIFY_DONE;223223+224224+ mutex_lock(&cooling_list_lock);225225+ list_for_each_entry(cpufreq_dev, &cpufreq_dev_list, node) {226226+ if (!cpumask_test_cpu(policy->cpu, &cpufreq_dev->allowed_cpus))227227+ continue;228228+229229+ /*230230+ * policy->max is the maximum allowed frequency defined by user231231+ * and clipped_freq is the maximum that thermal constraints232232+ * allow.233233+ *234234+ * If clipped_freq is lower than policy->max, then we need to235235+ * readjust policy->max.236236+ *237237+ * But, if clipped_freq is greater than policy->max, we don't238238+ * need to do anything.239239+ */240240+ clipped_freq = cpufreq_dev->clipped_freq;241241+242242+ if (policy->max > clipped_freq)243243+ cpufreq_verify_within_limits(policy, 0, clipped_freq);244244+ break;243245 }246246+ mutex_unlock(&cooling_list_lock);244247245248 return NOTIFY_OK;246249}···528519529520 clip_freq = cpufreq_device->freq_table[state];530521 cpufreq_device->cpufreq_state = state;531531- cpufreq_device->cpufreq_val = clip_freq;522522+ cpufreq_device->clipped_freq = clip_freq;532523533524 cpufreq_update_policy(cpu);534525···870861 pr_debug("%s: freq:%u KHz\n", __func__, freq);871862 }872863873873- cpufreq_dev->cpufreq_val = cpufreq_dev->freq_table[0];864864+ cpufreq_dev->clipped_freq = cpufreq_dev->freq_table[0];874865 cpufreq_dev->cool_dev = cool_dev;875866876867 mutex_lock(&cooling_cpufreq_lock);877868869869+ mutex_lock(&cooling_list_lock);870870+ list_add(&cpufreq_dev->node, &cpufreq_dev_list);871871+ mutex_unlock(&cooling_list_lock);872872+878873 /* Register the notifier for first cpufreq cooling device */879879- if (list_empty(&cpufreq_dev_list))874874+ if (!cpufreq_dev_count++)880875 cpufreq_register_notifier(&thermal_cpufreq_notifier_block,881876 CPUFREQ_POLICY_NOTIFIER);882882- list_add(&cpufreq_dev->node, &cpufreq_dev_list);883883-884877 mutex_unlock(&cooling_cpufreq_lock);885878886879 return cool_dev;···10241013 return;1025101410261015 cpufreq_dev = cdev->devdata;10271027- mutex_lock(&cooling_cpufreq_lock);10281028- list_del(&cpufreq_dev->node);1029101610301017 /* Unregister the notifier for the last cpufreq cooling device */10311031- if (list_empty(&cpufreq_dev_list))10181018+ mutex_lock(&cooling_cpufreq_lock);10191019+ if (!--cpufreq_dev_count)10321020 cpufreq_unregister_notifier(&thermal_cpufreq_notifier_block,10331021 CPUFREQ_POLICY_NOTIFIER);10221022+10231023+ mutex_lock(&cooling_list_lock);10241024+ list_del(&cpufreq_dev->node);10251025+ mutex_unlock(&cooling_list_lock);10261026+10341027 mutex_unlock(&cooling_cpufreq_lock);1035102810361029 thermal_cooling_device_unregister(cpufreq_dev->cool_dev);
···141141 int io_ops_count;142142};143143144144+#ifdef CONFIG_SND_SOC_TOPOLOGY145145+144146/* gets a pointer to data from the firmware block header */145147static inline const void *snd_soc_tplg_get_data(struct snd_soc_tplg_hdr *hdr)146148{···166164int snd_soc_tplg_widget_bind_event(struct snd_soc_dapm_widget *w,167165 const struct snd_soc_tplg_widget_events *events, int num_events,168166 u16 event_type);167167+168168+#else169169+170170+static inline int snd_soc_tplg_component_remove(struct snd_soc_component *comp,171171+ u32 index)172172+{173173+ return 0;174174+}175175+176176+#endif169177170178#endif
+6
include/uapi/sound/asoc.h
···1818#include <linux/types.h>1919#include <sound/asound.h>20202121+#ifndef __KERNEL__2222+#error This API is an early revision and not enabled in the current2323+#error kernel release, it will be enabled in a future kernel version2424+#error with incompatible changes to what is here.2525+#endif2626+2127/*2228 * Maximum number of channels topology kcontrol can represent.2329 */
+36-13
ipc/sem.c
···253253}254254255255/*256256+ * spin_unlock_wait() and !spin_is_locked() are not memory barriers, they257257+ * are only control barriers.258258+ * The code must pair with spin_unlock(&sem->lock) or259259+ * spin_unlock(&sem_perm.lock), thus just the control barrier is insufficient.260260+ *261261+ * smp_rmb() is sufficient, as writes cannot pass the control barrier.262262+ */263263+#define ipc_smp_acquire__after_spin_is_unlocked() smp_rmb()264264+265265+/*256266 * Wait until all currently ongoing simple ops have completed.257267 * Caller must own sem_perm.lock.258268 * New simple ops cannot start, because simple ops first check···285275 sem = sma->sem_base + i;286276 spin_unlock_wait(&sem->lock);287277 }278278+ ipc_smp_acquire__after_spin_is_unlocked();288279}289280290281/*···338327 /* Then check that the global lock is free */339328 if (!spin_is_locked(&sma->sem_perm.lock)) {340329 /*341341- * The ipc object lock check must be visible on all342342- * cores before rechecking the complex count. Otherwise343343- * we can race with another thread that does:330330+ * We need a memory barrier with acquire semantics,331331+ * otherwise we can race with another thread that does:344332 * complex_count++;345333 * spin_unlock(sem_perm.lock);346334 */347347- smp_rmb();335335+ ipc_smp_acquire__after_spin_is_unlocked();348336349337 /*350338 * Now repeat the test of complex_count:···20842074 rcu_read_lock();20852075 un = list_entry_rcu(ulp->list_proc.next,20862076 struct sem_undo, list_proc);20872087- if (&un->list_proc == &ulp->list_proc)20882088- semid = -1;20892089- else20902090- semid = un->semid;20912091-20922092- if (semid == -1) {20772077+ if (&un->list_proc == &ulp->list_proc) {20782078+ /*20792079+ * We must wait for freeary() before freeing this ulp,20802080+ * in case we raced with last sem_undo. There is a small20812081+ * possibility where we exit while freeary() didn't20822082+ * finish unlocking sem_undo_list.20832083+ */20842084+ spin_unlock_wait(&ulp->lock);20932085 rcu_read_unlock();20942086 break;20952087 }20882088+ spin_lock(&ulp->lock);20892089+ semid = un->semid;20902090+ spin_unlock(&ulp->lock);2096209120972097- sma = sem_obtain_object_check(tsk->nsproxy->ipc_ns, un->semid);20922092+ /* exit_sem raced with IPC_RMID, nothing to do */20932093+ if (semid == -1) {20942094+ rcu_read_unlock();20952095+ continue;20962096+ }20972097+20982098+ sma = sem_obtain_object_check(tsk->nsproxy->ipc_ns, semid);20982099 /* exit_sem raced with IPC_RMID, nothing to do */20992100 if (IS_ERR(sma)) {21002101 rcu_read_unlock();···21332112 ipc_assert_locked_object(&sma->sem_perm);21342113 list_del(&un->list_id);2135211421362136- spin_lock(&ulp->lock);21152115+ /* we are the last process using this ulp, acquiring ulp->lock21162116+ * isn't required. Besides that, we are also protected against21172117+ * IPC_RMID as we hold sma->sem_perm lock now21182118+ */21372119 list_del_rcu(&un->list_proc);21382138- spin_unlock(&ulp->lock);2139212021402121 /* perform adjustments registered in un */21412122 for (i = 0; i < sma->sem_nsems; i++) {
+1-1
kernel/cpuset.c
···12231223 spin_unlock_irq(&callback_lock);1224122412251225 /* use trialcs->mems_allowed as a temp variable */12261226- update_nodemasks_hier(cs, &cs->mems_allowed);12261226+ update_nodemasks_hier(cs, &trialcs->mems_allowed);12271227done:12281228 return retval;12291229}
+67-24
kernel/events/core.c
···1868186818691869 perf_pmu_disable(event->pmu);1870187018711871- event->tstamp_running += tstamp - event->tstamp_stopped;18721872-18731871 perf_set_shadow_time(event, ctx, tstamp);1874187218751873 perf_log_itrace_start(event);···18781880 ret = -EAGAIN;18791881 goto out;18801882 }18831883+18841884+ event->tstamp_running += tstamp - event->tstamp_stopped;1881188518821886 if (!is_software_event(event))18831887 cpuctx->active_oncpu++;···40114011 perf_event_for_each_child(sibling, func);40124012}4013401340144014-static int perf_event_period(struct perf_event *event, u64 __user *arg)40154015-{40164016- struct perf_event_context *ctx = event->ctx;40174017- int ret = 0, active;40144014+struct period_event {40154015+ struct perf_event *event;40184016 u64 value;40174017+};4019401840204020- if (!is_sampling_event(event))40214021- return -EINVAL;40194019+static int __perf_event_period(void *info)40204020+{40214021+ struct period_event *pe = info;40224022+ struct perf_event *event = pe->event;40234023+ struct perf_event_context *ctx = event->ctx;40244024+ u64 value = pe->value;40254025+ bool active;4022402640234023- if (copy_from_user(&value, arg, sizeof(value)))40244024- return -EFAULT;40254025-40264026- if (!value)40274027- return -EINVAL;40284028-40294029- raw_spin_lock_irq(&ctx->lock);40274027+ raw_spin_lock(&ctx->lock);40304028 if (event->attr.freq) {40314031- if (value > sysctl_perf_event_sample_rate) {40324032- ret = -EINVAL;40334033- goto unlock;40344034- }40354035-40364029 event->attr.sample_freq = value;40374030 } else {40384031 event->attr.sample_period = value;···40444051 event->pmu->start(event, PERF_EF_RELOAD);40454052 perf_pmu_enable(ctx->pmu);40464053 }40544054+ raw_spin_unlock(&ctx->lock);4047405540484048-unlock:40564056+ return 0;40574057+}40584058+40594059+static int perf_event_period(struct perf_event *event, u64 __user *arg)40604060+{40614061+ struct period_event pe = { .event = event, };40624062+ struct perf_event_context *ctx = event->ctx;40634063+ struct task_struct *task;40644064+ u64 value;40654065+40664066+ if (!is_sampling_event(event))40674067+ return -EINVAL;40684068+40694069+ if (copy_from_user(&value, arg, sizeof(value)))40704070+ return -EFAULT;40714071+40724072+ if (!value)40734073+ return -EINVAL;40744074+40754075+ if (event->attr.freq && value > sysctl_perf_event_sample_rate)40764076+ return -EINVAL;40774077+40784078+ task = ctx->task;40794079+ pe.value = value;40804080+40814081+ if (!task) {40824082+ cpu_function_call(event->cpu, __perf_event_period, &pe);40834083+ return 0;40844084+ }40854085+40864086+retry:40874087+ if (!task_function_call(task, __perf_event_period, &pe))40884088+ return 0;40894089+40904090+ raw_spin_lock_irq(&ctx->lock);40914091+ if (ctx->is_active) {40924092+ raw_spin_unlock_irq(&ctx->lock);40934093+ task = ctx->task;40944094+ goto retry;40954095+ }40964096+40974097+ __perf_event_period(&pe);40494098 raw_spin_unlock_irq(&ctx->lock);4050409940514051- return ret;41004100+ return 0;40524101}4053410240544103static const struct file_operations perf_fops;···48284793 * to user-space before waking everybody up.48294794 */4830479547964796+static inline struct fasync_struct **perf_event_fasync(struct perf_event *event)47974797+{47984798+ /* only the parent has fasync state */47994799+ if (event->parent)48004800+ event = event->parent;48014801+ return &event->fasync;48024802+}48034803+48314804void perf_event_wakeup(struct perf_event *event)48324805{48334806 ring_buffer_wakeup(event);4834480748354808 if (event->pending_kill) {48364836- kill_fasync(&event->fasync, SIGIO, event->pending_kill);48094809+ kill_fasync(perf_event_fasync(event), SIGIO, event->pending_kill);48374810 event->pending_kill = 0;48384811 }48394812}···62206177 else62216178 perf_event_output(event, data, regs);6222617962236223- if (event->fasync && event->pending_kill) {61806180+ if (*perf_event_fasync(event) && event->pending_kill) {62246181 event->pending_wakeup = 1;62256182 irq_work_queue(&event->pending);62266183 }
···4455#include <linux/hash.h>66#include <linux/bootmem.h>77+#include <linux/debug_locks.h>7889/*910 * Implement paravirt qspinlocks; the general idea is to halt the vcpus instead···287286{288287 struct __qspinlock *l = (void *)lock;289288 struct pv_node *node;289289+ u8 lockval = cmpxchg(&l->locked, _Q_LOCKED_VAL, 0);290290291291 /*292292 * We must not unlock if SLOW, because in that case we must first293293 * unhash. Otherwise it would be possible to have multiple @lock294294 * entries, which would be BAD.295295 */296296- if (likely(cmpxchg(&l->locked, _Q_LOCKED_VAL, 0) == _Q_LOCKED_VAL))296296+ if (likely(lockval == _Q_LOCKED_VAL))297297 return;298298+299299+ if (unlikely(lockval != _Q_SLOW_VAL)) {300300+ if (debug_locks_silent)301301+ return;302302+ WARN(1, "pvqspinlock: lock %p has corrupted value 0x%x!\n", lock, atomic_read(&lock->val));303303+ return;304304+ }298305299306 /*300307 * Since the above failed to release, this must be the SLOW path.
···22 * This file contains error reporting code.33 *44 * Copyright (c) 2014 Samsung Electronics Co., Ltd.55- * Author: Andrey Ryabinin <a.ryabinin@samsung.com>55+ * Author: Andrey Ryabinin <ryabinin.a.a@gmail.com>66 *77 * Some of code borrowed from https://github.com/xairy/linux by88 * Andrey Konovalov <adech.fo@gmail.com>
+13-9
mm/memory-failure.c
···11461146 }1147114711481148 if (!PageHuge(p) && PageTransHuge(hpage)) {11491149- if (unlikely(split_huge_page(hpage))) {11501150- pr_err("MCE: %#lx: thp split failed\n", pfn);11491149+ if (!PageAnon(hpage) || unlikely(split_huge_page(hpage))) {11501150+ if (!PageAnon(hpage))11511151+ pr_err("MCE: %#lx: non anonymous thp\n", pfn);11521152+ else11531153+ pr_err("MCE: %#lx: thp split failed\n", pfn);11511154 if (TestClearPageHWPoison(p))11521155 atomic_long_sub(nr_pages, &num_poisoned_pages);11531156 put_page(p);···15411538 */15421539 ret = __get_any_page(page, pfn, 0);15431540 if (!PageLRU(page)) {15411541+ /* Drop page reference which is from __get_any_page() */15421542+ put_page(page);15441543 pr_info("soft_offline: %#lx: unknown non LRU page type %lx\n",15451544 pfn, page->flags);15461545 return -EIO;···15721567 unlock_page(hpage);1573156815741569 ret = isolate_huge_page(hpage, &pagelist);15751575- if (ret) {15761576- /*15771577- * get_any_page() and isolate_huge_page() takes a refcount each,15781578- * so need to drop one here.15791579- */15801580- put_page(hpage);15811581- } else {15701570+ /*15711571+ * get_any_page() and isolate_huge_page() takes a refcount each,15721572+ * so need to drop one here.15731573+ */15741574+ put_page(hpage);15751575+ if (!ret) {15821576 pr_info("soft offline: %#lx hugepage failed to isolate\n", pfn);15831577 return -EBUSY;15841578 }
···50605060{50615061 unsigned long zone_start_pfn, zone_end_pfn;5062506250635063+ /* When hotadd a new node, the node should be empty */50645064+ if (!node_start_pfn && !node_end_pfn)50655065+ return 0;50665066+50635067 /* Get the start and end of the zone */50645068 zone_start_pfn = arch_zone_lowest_possible_pfn[zone_type];50655069 zone_end_pfn = arch_zone_highest_possible_pfn[zone_type];···51265122 unsigned long zone_low = arch_zone_lowest_possible_pfn[zone_type];51275123 unsigned long zone_high = arch_zone_highest_possible_pfn[zone_type];51285124 unsigned long zone_start_pfn, zone_end_pfn;51255125+51265126+ /* When hotadd a new node, the node should be empty */51275127+ if (!node_start_pfn && !node_end_pfn)51285128+ return 0;5129512951305130 zone_start_pfn = clamp(node_start_pfn, zone_low, zone_high);51315131 zone_end_pfn = clamp(node_end_pfn, zone_low, zone_high);
+4-1
net/batman-adv/translation-table.c
···596596 /* increase the refcounter of the related vlan */597597 vlan = batadv_softif_vlan_get(bat_priv, vid);598598 if (WARN(!vlan, "adding TT local entry %pM to non-existent VLAN %d",599599- addr, BATADV_PRINT_VID(vid)))599599+ addr, BATADV_PRINT_VID(vid))) {600600+ kfree(tt_local);601601+ tt_local = NULL;600602 goto out;603603+ }601604602605 batadv_dbg(BATADV_DBG_TT, bat_priv,603606 "Creating new local tt entry: %pM (vid: %d, ttvn: %d)\n",
···40224022 * Otherwise returns the provided skb. Returns NULL in error cases40234023 * (e.g. transport_len exceeds skb length or out-of-memory).40244024 *40254025- * Caller needs to set the skb transport header and release the returned skb.40264026- * Provided skb is consumed.40254025+ * Caller needs to set the skb transport header and free any returned skb if it40264026+ * differs from the provided skb.40274027 */40284028static struct sk_buff *skb_checksum_maybe_trim(struct sk_buff *skb,40294029 unsigned int transport_len)···40324032 unsigned int len = skb_transport_offset(skb) + transport_len;40334033 int ret;4034403440354035- if (skb->len < len) {40364036- kfree_skb(skb);40354035+ if (skb->len < len)40374036 return NULL;40384038- } else if (skb->len == len) {40374037+ else if (skb->len == len)40394038 return skb;40404040- }4041403940424040 skb_chk = skb_clone(skb, GFP_ATOMIC);40434043- kfree_skb(skb);40444044-40454041 if (!skb_chk)40464042 return NULL;40474043···40624066 * If the skb has data beyond the given transport length, then a40634067 * trimmed & cloned skb is checked and returned.40644068 *40654065- * Caller needs to set the skb transport header and release the returned skb.40664066- * Provided skb is consumed.40694069+ * Caller needs to set the skb transport header and free any returned skb if it40704070+ * differs from the provided skb.40674071 */40684072struct sk_buff *skb_checksum_trimmed(struct sk_buff *skb,40694073 unsigned int transport_len,···4075407940764080 skb_chk = skb_checksum_maybe_trim(skb, transport_len);40774081 if (!skb_chk)40784078- return NULL;40824082+ goto err;4079408340804080- if (!pskb_may_pull(skb_chk, offset)) {40814081- kfree_skb(skb_chk);40824082- return NULL;40834083- }40844084+ if (!pskb_may_pull(skb_chk, offset))40854085+ goto err;4084408640854087 __skb_pull(skb_chk, offset);40864088 ret = skb_chkf(skb_chk);40874089 __skb_push(skb_chk, offset);4088409040894089- if (ret) {40904090- kfree_skb(skb_chk);40914091- return NULL;40924092- }40914091+ if (ret)40924092+ goto err;4093409340944094 return skb_chk;40954095+40964096+err:40974097+ if (skb_chk && skb_chk != skb)40984098+ kfree_skb(skb_chk);40994099+41004100+ return NULL;41014101+40954102}40964103EXPORT_SYMBOL(skb_checksum_trimmed);40974104
···14351435 struct sk_buff *skb_chk;14361436 unsigned int transport_len;14371437 unsigned int len = skb_transport_offset(skb) + sizeof(struct igmphdr);14381438- int ret;14381438+ int ret = -EINVAL;1439143914401440 transport_len = ntohs(ip_hdr(skb)->tot_len) - ip_hdrlen(skb);1441144114421442- skb_get(skb);14431442 skb_chk = skb_checksum_trimmed(skb, transport_len,14441443 ip_mc_validate_checksum);14451444 if (!skb_chk)14461446- return -EINVAL;14451445+ goto err;1447144614481448- if (!pskb_may_pull(skb_chk, len)) {14491449- kfree_skb(skb_chk);14501450- return -EINVAL;14511451- }14471447+ if (!pskb_may_pull(skb_chk, len))14481448+ goto err;1452144914531450 ret = ip_mc_check_igmp_msg(skb_chk);14541454- if (ret) {14551455- kfree_skb(skb_chk);14561456- return ret;14571457- }14511451+ if (ret)14521452+ goto err;1458145314591454 if (skb_trimmed)14601455 *skb_trimmed = skb_chk;14611461- else14561456+ /* free now unneeded clone */14571457+ else if (skb_chk != skb)14621458 kfree_skb(skb_chk);1463145914641464- return 0;14601460+ ret = 0;14611461+14621462+err:14631463+ if (ret && skb_chk && skb_chk != skb)14641464+ kfree_skb(skb_chk);14651465+14661466+ return ret;14651467}1466146814671469/**···14721470 * @skb_trimmed: to store an skb pointer trimmed to IPv4 packet tail (optional)14731471 *14741472 * Checks whether an IPv4 packet is a valid IGMP packet. If so sets14751475- * skb network and transport headers accordingly and returns zero.14731473+ * skb transport header accordingly and returns zero.14761474 *14771475 * -EINVAL: A broken packet was detected, i.e. it violates some internet14781476 * standard···14871485 * to leave the original skb and its full frame unchanged (which might be14881486 * desirable for layer 2 frame jugglers).14891487 *14901490- * The caller needs to release a reference count from any returned skb_trimmed.14881488+ * Caller needs to set the skb network header and free any returned skb if it14891489+ * differs from the provided skb.14911490 */14921491int ip_mc_check_igmp(struct sk_buff *skb, struct sk_buff **skb_trimmed)14931492{
+1-1
net/ipv4/inet_connection_sock.c
···593593 }594594595595 spin_unlock(&queue->syn_wait_lock);596596- if (del_timer_sync(&req->rsk_timer))596596+ if (timer_pending(&req->rsk_timer) && del_timer_sync(&req->rsk_timer))597597 reqsk_put(req);598598 return found;599599}
···143143 struct sk_buff *skb_chk = NULL;144144 unsigned int transport_len;145145 unsigned int len = skb_transport_offset(skb) + sizeof(struct mld_msg);146146- int ret;146146+ int ret = -EINVAL;147147148148 transport_len = ntohs(ipv6_hdr(skb)->payload_len);149149 transport_len -= skb_transport_offset(skb) - sizeof(struct ipv6hdr);150150151151- skb_get(skb);152151 skb_chk = skb_checksum_trimmed(skb, transport_len,153152 ipv6_mc_validate_checksum);154153 if (!skb_chk)155155- return -EINVAL;154154+ goto err;156155157157- if (!pskb_may_pull(skb_chk, len)) {158158- kfree_skb(skb_chk);159159- return -EINVAL;160160- }156156+ if (!pskb_may_pull(skb_chk, len))157157+ goto err;161158162159 ret = ipv6_mc_check_mld_msg(skb_chk);163163- if (ret) {164164- kfree_skb(skb_chk);165165- return ret;166166- }160160+ if (ret)161161+ goto err;167162168163 if (skb_trimmed)169164 *skb_trimmed = skb_chk;170170- else165165+ /* free now unneeded clone */166166+ else if (skb_chk != skb)171167 kfree_skb(skb_chk);172168173173- return 0;169169+ ret = 0;170170+171171+err:172172+ if (ret && skb_chk && skb_chk != skb)173173+ kfree_skb(skb_chk);174174+175175+ return ret;174176}175177176178/**···181179 * @skb_trimmed: to store an skb pointer trimmed to IPv6 packet tail (optional)182180 *183181 * Checks whether an IPv6 packet is a valid MLD packet. If so sets184184- * skb network and transport headers accordingly and returns zero.182182+ * skb transport header accordingly and returns zero.185183 *186184 * -EINVAL: A broken packet was detected, i.e. it violates some internet187185 * standard···196194 * to leave the original skb and its full frame unchanged (which might be197195 * desirable for layer 2 frame jugglers).198196 *199199- * The caller needs to release a reference count from any returned skb_trimmed.197197+ * Caller needs to set the skb network header and free any returned skb if it198198+ * differs from the provided skb.200199 */201200int ipv6_mc_check_mld(struct sk_buff *skb, struct sk_buff **skb_trimmed)202201{
+55-24
net/ipv6/route.c
···321321/* allocate dst with ip6_dst_ops */322322static struct rt6_info *__ip6_dst_alloc(struct net *net,323323 struct net_device *dev,324324- int flags,325325- struct fib6_table *table)324324+ int flags)326325{327326 struct rt6_info *rt = dst_alloc(&net->ipv6.ip6_dst_ops, dev,328327 0, DST_OBSOLETE_FORCE_CHK, flags);···338339339340static struct rt6_info *ip6_dst_alloc(struct net *net,340341 struct net_device *dev,341341- int flags,342342- struct fib6_table *table)342342+ int flags)343343{344344- struct rt6_info *rt = __ip6_dst_alloc(net, dev, flags, table);344344+ struct rt6_info *rt = __ip6_dst_alloc(net, dev, flags);345345346346 if (rt) {347347 rt->rt6i_pcpu = alloc_percpu_gfp(struct rt6_info *, GFP_ATOMIC);···957959 if (ort->rt6i_flags & (RTF_CACHE | RTF_PCPU))958960 ort = (struct rt6_info *)ort->dst.from;959961960960- rt = __ip6_dst_alloc(dev_net(ort->dst.dev), ort->dst.dev,961961- 0, ort->rt6i_table);962962+ rt = __ip6_dst_alloc(dev_net(ort->dst.dev), ort->dst.dev, 0);962963963964 if (!rt)964965 return NULL;···989992 struct rt6_info *pcpu_rt;990993991994 pcpu_rt = __ip6_dst_alloc(dev_net(rt->dst.dev),992992- rt->dst.dev, rt->dst.flags,993993- rt->rt6i_table);995995+ rt->dst.dev, rt->dst.flags);994996995997 if (!pcpu_rt)996998 return NULL;···10021006/* It should be called with read_lock_bh(&tb6_lock) acquired */10031007static struct rt6_info *rt6_get_pcpu_route(struct rt6_info *rt)10041008{10051005- struct rt6_info *pcpu_rt, *prev, **p;10091009+ struct rt6_info *pcpu_rt, **p;1006101010071011 p = this_cpu_ptr(rt->rt6i_pcpu);10081012 pcpu_rt = *p;1009101310101010- if (pcpu_rt)10111011- goto done;10141014+ if (pcpu_rt) {10151015+ dst_hold(&pcpu_rt->dst);10161016+ rt6_dst_from_metrics_check(pcpu_rt);10171017+ }10181018+ return pcpu_rt;10191019+}10201020+10211021+static struct rt6_info *rt6_make_pcpu_route(struct rt6_info *rt)10221022+{10231023+ struct fib6_table *table = rt->rt6i_table;10241024+ struct rt6_info *pcpu_rt, *prev, **p;1012102510131026 pcpu_rt = ip6_rt_pcpu_alloc(rt);10141027 if (!pcpu_rt) {10151028 struct net *net = dev_net(rt->dst.dev);1016102910171017- pcpu_rt = net->ipv6.ip6_null_entry;10181018- goto done;10301030+ dst_hold(&net->ipv6.ip6_null_entry->dst);10311031+ return net->ipv6.ip6_null_entry;10191032 }1020103310211021- prev = cmpxchg(p, NULL, pcpu_rt);10221022- if (prev) {10231023- /* If someone did it before us, return prev instead */10341034+ read_lock_bh(&table->tb6_lock);10351035+ if (rt->rt6i_pcpu) {10361036+ p = this_cpu_ptr(rt->rt6i_pcpu);10371037+ prev = cmpxchg(p, NULL, pcpu_rt);10381038+ if (prev) {10391039+ /* If someone did it before us, return prev instead */10401040+ dst_destroy(&pcpu_rt->dst);10411041+ pcpu_rt = prev;10421042+ }10431043+ } else {10441044+ /* rt has been removed from the fib6 tree10451045+ * before we have a chance to acquire the read_lock.10461046+ * In this case, don't brother to create a pcpu rt10471047+ * since rt is going away anyway. The next10481048+ * dst_check() will trigger a re-lookup.10491049+ */10241050 dst_destroy(&pcpu_rt->dst);10251025- pcpu_rt = prev;10511051+ pcpu_rt = rt;10261052 }10271027-10281028-done:10291053 dst_hold(&pcpu_rt->dst);10301054 rt6_dst_from_metrics_check(pcpu_rt);10551055+ read_unlock_bh(&table->tb6_lock);10311056 return pcpu_rt;10321057}10331058···11231106 rt->dst.lastuse = jiffies;11241107 rt->dst.__use++;11251108 pcpu_rt = rt6_get_pcpu_route(rt);11261126- read_unlock_bh(&table->tb6_lock);11091109+11101110+ if (pcpu_rt) {11111111+ read_unlock_bh(&table->tb6_lock);11121112+ } else {11131113+ /* We have to do the read_unlock first11141114+ * because rt6_make_pcpu_route() may trigger11151115+ * ip6_dst_gc() which will take the write_lock.11161116+ */11171117+ dst_hold(&rt->dst);11181118+ read_unlock_bh(&table->tb6_lock);11191119+ pcpu_rt = rt6_make_pcpu_route(rt);11201120+ dst_release(&rt->dst);11211121+ }1127112211281123 return pcpu_rt;11241124+11291125 }11301126}11311127···15991569 if (unlikely(!idev))16001570 return ERR_PTR(-ENODEV);1601157116021602- rt = ip6_dst_alloc(net, dev, 0, NULL);15721572+ rt = ip6_dst_alloc(net, dev, 0);16031573 if (unlikely(!rt)) {16041574 in6_dev_put(idev);16051575 dst = ERR_PTR(-ENOMEM);···17861756 if (!table)17871757 goto out;1788175817891789- rt = ip6_dst_alloc(net, NULL, (cfg->fc_flags & RTF_ADDRCONF) ? 0 : DST_NOCOUNT, table);17591759+ rt = ip6_dst_alloc(net, NULL,17601760+ (cfg->fc_flags & RTF_ADDRCONF) ? 0 : DST_NOCOUNT);1790176117911762 if (!rt) {17921763 err = -ENOMEM;···24632432{24642433 struct net *net = dev_net(idev->dev);24652434 struct rt6_info *rt = ip6_dst_alloc(net, net->loopback_dev,24662466- DST_NOCOUNT, NULL);24352435+ DST_NOCOUNT);24672436 if (!rt)24682437 return ERR_PTR(-ENOMEM);24692438
+6-5
net/mac80211/rc80211_minstrel.c
···9292static inline void9393minstrel_sort_best_tp_rates(struct minstrel_sta_info *mi, int i, u8 *tp_list)9494{9595- int j = MAX_THR_RATES;9696- struct minstrel_rate_stats *tmp_mrs = &mi->r[j - 1].stats;9595+ int j;9696+ struct minstrel_rate_stats *tmp_mrs;9797 struct minstrel_rate_stats *cur_mrs = &mi->r[i].stats;98989999- while (j > 0 && (minstrel_get_tp_avg(&mi->r[i], cur_mrs->prob_ewma) >100100- minstrel_get_tp_avg(&mi->r[tp_list[j - 1]], tmp_mrs->prob_ewma))) {101101- j--;9999+ for (j = MAX_THR_RATES; j > 0; --j) {102100 tmp_mrs = &mi->r[tp_list[j - 1]].stats;101101+ if (minstrel_get_tp_avg(&mi->r[i], cur_mrs->prob_ewma) <=102102+ minstrel_get_tp_avg(&mi->r[tp_list[j - 1]], tmp_mrs->prob_ewma))103103+ break;103104 }104105105106 if (j < MAX_THR_RATES - 1)